Submission #3817879


Source Code Expand

#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define sz(a) (a).size()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define dump(x) cerr << #x << " = " << (x) << endl;
#define dumpi(i, x) cerr << string((i), ' ') << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
using pii = pair<int, int>;
constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr double EPS = 1e-10;

int N, M, D;
int A[200010];
int tmp[100010];
int nxt[31][100010];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M >> D;
  iota(tmp, tmp+N, 0);
  rep(i, 0, M) {
    cin >> A[i];
    A[i]--;
    swap(tmp[A[i]], tmp[A[i]+1]);
  }
  rep(i, 0, N) {
    nxt[0][tmp[i]] = i;
  }
  rep(i, 0, 30) {
    rep(j, 0, N) {
      nxt[i+1][j] = nxt[i][nxt[i][j]];
    }
  }
  rep(i, 0, N) {
    int p = i;
    for (int i = 30; i >= 0; i--) {
      if (D & (1LL << i)) p = nxt[i][p];
    }
    cout << p+1 << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User legosuke
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1288 Byte
Status AC
Exec Time 192 ms
Memory 27392 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 184 ms 27392 KB
01_random01.txt AC 6 ms 22784 KB
01_random02.txt AC 6 ms 22784 KB
01_random03.txt AC 6 ms 22784 KB
01_random04.txt AC 12 ms 22912 KB
01_random05.txt AC 172 ms 26112 KB
01_random06.txt AC 184 ms 27008 KB
01_random07.txt AC 186 ms 27392 KB
02_i.txt AC 8 ms 22912 KB
02_p.txt AC 7 ms 22784 KB
02_random01.txt AC 6 ms 22784 KB
02_random02.txt AC 6 ms 22784 KB
02_random03.txt AC 7 ms 22912 KB
02_random04.txt AC 7 ms 22784 KB
02_random05.txt AC 9 ms 23040 KB
02_random06.txt AC 14 ms 23552 KB
02_random07.txt AC 21 ms 24448 KB
02_random08.txt AC 21 ms 24448 KB
02_rp01.txt AC 8 ms 22784 KB
02_rp02.txt AC 8 ms 22784 KB
02_rp03.txt AC 8 ms 22784 KB
02_rp04.txt AC 7 ms 22784 KB
02_rp05.txt AC 8 ms 22784 KB
03_i.txt AC 6 ms 22784 KB
03_random01.txt AC 7 ms 22912 KB
03_random02.txt AC 17 ms 24320 KB
03_random03.txt AC 15 ms 24064 KB
03_random04.txt AC 15 ms 24064 KB
03_random05.txt AC 8 ms 23040 KB
03_random06.txt AC 7 ms 23040 KB
03_random07.txt AC 8 ms 23168 KB
03_random08.txt AC 6 ms 22784 KB
03_random09.txt AC 9 ms 23296 KB
03_random10.txt AC 12 ms 23680 KB
03_random11.txt AC 16 ms 24192 KB
03_random12.txt AC 17 ms 24320 KB
03_random13.txt AC 14 ms 23936 KB
03_random14.txt AC 12 ms 23680 KB
03_random15.txt AC 8 ms 23168 KB
04_i.txt AC 192 ms 27392 KB
04_p1.txt AC 183 ms 26624 KB
04_p2.txt AC 150 ms 25856 KB
04_random01.txt AC 106 ms 25344 KB
04_random02.txt AC 86 ms 24448 KB
04_random03.txt AC 31 ms 23936 KB
04_random04.txt AC 34 ms 24576 KB
04_random05.txt AC 40 ms 24448 KB
04_random06.txt AC 113 ms 25344 KB
04_random07.txt AC 82 ms 25344 KB
04_random08.txt AC 71 ms 24960 KB
04_random09.txt AC 51 ms 24832 KB
04_random10.txt AC 114 ms 25216 KB
04_random11.txt AC 189 ms 27392 KB
04_random12.txt AC 190 ms 27392 KB
04_random13.txt AC 191 ms 27392 KB
04_rp01.txt AC 184 ms 26624 KB
04_rp02.txt AC 178 ms 26624 KB
04_rp03.txt AC 179 ms 26624 KB
04_rp04.txt AC 184 ms 26624 KB
04_rp05.txt AC 177 ms 26624 KB
04_rp06.txt AC 183 ms 26624 KB
04_rp07.txt AC 180 ms 26624 KB
04_rp08.txt AC 188 ms 26624 KB
04_rp09.txt AC 187 ms 26624 KB
04_rp10.txt AC 187 ms 26624 KB
sample_1.txt AC 6 ms 22784 KB
sample_2.txt AC 6 ms 22784 KB
sample_3.txt AC 6 ms 22784 KB