Submission #1594187


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int u[30][100010];

int main(void) {
  int n, m, d;
  cin >> n >> m >> d;

  vector<int> a(m), b(n);
  for (int i = 0; i < n; i++) {
    b[i] = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    a[i]--;
    swap(b[a[i]], b[a[i] + 1]);
  }

  for (int i = 0; i < n; i++) {
    u[0][b[i]] = i;
  }
  for (int i = 1; i < 30; i++) {
    for (int j = 0; j < n; j++) {
      u[i][j] = u[i - 1][u[i - 1][j]];
    }
  }

  for (int i = 0; i < n; i++) {
    int v = i;
    for (int j = 0; j < 30; j++) {
      if (d >> j & 1) {
        v = u[j][v];
      }
    }
    cout << v + 1 << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User legosuke
Language C++14 (GCC 5.4.1)
Score 100
Code Size 696 Byte
Status AC
Exec Time 223 ms
Memory 13696 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 20 / 20 50 / 50
Status
AC × 9
AC × 18
AC × 18
AC × 29
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt AC 219 ms 13696 KB
01_random01.txt AC 3 ms 8448 KB
01_random02.txt AC 3 ms 8448 KB
01_random03.txt AC 2 ms 8448 KB
01_random04.txt AC 10 ms 8576 KB
01_random05.txt AC 172 ms 13056 KB
01_random06.txt AC 205 ms 13568 KB
01_random07.txt AC 222 ms 13696 KB
02_i.txt AC 5 ms 8576 KB
02_p.txt AC 4 ms 8448 KB
02_random01.txt AC 3 ms 8448 KB
02_random02.txt AC 2 ms 8448 KB
02_random03.txt AC 5 ms 8448 KB
02_random04.txt AC 4 ms 8448 KB
02_random05.txt AC 8 ms 8576 KB
02_random06.txt AC 25 ms 8960 KB
02_random07.txt AC 47 ms 9344 KB
02_random08.txt AC 46 ms 9344 KB
02_rp01.txt AC 4 ms 8448 KB
02_rp02.txt AC 4 ms 8576 KB
02_rp03.txt AC 4 ms 8576 KB
02_rp04.txt AC 4 ms 8448 KB
02_rp05.txt AC 4 ms 8576 KB
03_i.txt AC 2 ms 8448 KB
03_random01.txt AC 5 ms 8576 KB
03_random02.txt AC 32 ms 9216 KB
03_random03.txt AC 27 ms 9088 KB
03_random04.txt AC 27 ms 9088 KB
03_random05.txt AC 8 ms 8576 KB
03_random06.txt AC 7 ms 8576 KB
03_random07.txt AC 10 ms 8704 KB
03_random08.txt AC 3 ms 8448 KB
03_random09.txt AC 11 ms 8704 KB
03_random10.txt AC 19 ms 8832 KB
03_random11.txt AC 31 ms 9216 KB
03_random12.txt AC 32 ms 9216 KB
03_random13.txt AC 26 ms 9088 KB
03_random14.txt AC 21 ms 8960 KB
03_random15.txt AC 10 ms 8704 KB
04_i.txt AC 221 ms 13696 KB
04_p1.txt AC 190 ms 13312 KB
04_p2.txt AC 152 ms 12288 KB
04_random01.txt AC 121 ms 11392 KB
04_random02.txt AC 86 ms 10624 KB
04_random03.txt AC 46 ms 9344 KB
04_random04.txt AC 62 ms 9600 KB
04_random05.txt AC 63 ms 9728 KB
04_random06.txt AC 125 ms 11520 KB
04_random07.txt AC 114 ms 10752 KB
04_random08.txt AC 96 ms 10496 KB
04_random09.txt AC 81 ms 9984 KB
04_random10.txt AC 122 ms 11392 KB
04_random11.txt AC 218 ms 13696 KB
04_random12.txt AC 223 ms 13696 KB
04_random13.txt AC 221 ms 13696 KB
04_rp01.txt AC 198 ms 13312 KB
04_rp02.txt AC 192 ms 13312 KB
04_rp03.txt AC 193 ms 13312 KB
04_rp04.txt AC 191 ms 13312 KB
04_rp05.txt AC 191 ms 13312 KB
04_rp06.txt AC 190 ms 13312 KB
04_rp07.txt AC 193 ms 13312 KB
04_rp08.txt AC 194 ms 13312 KB
04_rp09.txt AC 193 ms 13312 KB
04_rp10.txt AC 194 ms 13312 KB
sample_1.txt AC 3 ms 8448 KB
sample_2.txt AC 3 ms 8448 KB
sample_3.txt AC 3 ms 8448 KB