Submission #1603376


Source Code Expand

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int to[100005][33]; // 2^j回でi->to[i]
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, M, D;
  cin >> N >> M >> D;
  int num[N + 1];
  FOR(i,0,N+1) {
    num[i] = i;
  }
  FOR(i,0,M) {
    int in;
    cin >> in;
    swap(num[in], num[in + 1]);
  }
  FOR(i,0,N+1) {
    to[num[i]][0] = i;
  }
  
    FOR(j,1,33) {
      FOR(i,0,N+1) {
      to[i][j] = to[to[i][j-1]][j-1];
    }
  }
  FOR(i,1,N+1) {
    int ret = i;
    int k = 0;
    ll DD = D;
    while (DD)
    {
      if(DD & 1) {
        ret = to[ret][k];
      }
      k++;
      DD >>= 1;
    }
    cout << ret << endl;
  }
  return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User nenuon
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1083 Byte
Status AC
Exec Time 189 ms
Memory 14080 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 178 ms 14080 KB
01_random01.txt AC 1 ms 256 KB
01_random02.txt AC 1 ms 256 KB
01_random03.txt AC 1 ms 256 KB
01_random04.txt AC 7 ms 640 KB
01_random05.txt AC 166 ms 14080 KB
01_random06.txt AC 176 ms 14080 KB
01_random07.txt AC 189 ms 14080 KB
02_i.txt AC 3 ms 384 KB
02_p.txt AC 3 ms 384 KB
02_random01.txt AC 1 ms 256 KB
02_random02.txt AC 1 ms 256 KB
02_random03.txt AC 3 ms 384 KB
02_random04.txt AC 3 ms 384 KB
02_random05.txt AC 4 ms 384 KB
02_random06.txt AC 9 ms 384 KB
02_random07.txt AC 16 ms 384 KB
02_random08.txt AC 16 ms 384 KB
02_rp01.txt AC 3 ms 384 KB
02_rp02.txt AC 3 ms 384 KB
02_rp03.txt AC 3 ms 384 KB
02_rp04.txt AC 3 ms 384 KB
02_rp05.txt AC 3 ms 384 KB
03_i.txt AC 1 ms 256 KB
03_random01.txt AC 2 ms 256 KB
03_random02.txt AC 11 ms 256 KB
03_random03.txt AC 10 ms 256 KB
03_random04.txt AC 10 ms 256 KB
03_random05.txt AC 3 ms 256 KB
03_random06.txt AC 3 ms 256 KB
03_random07.txt AC 3 ms 256 KB
03_random08.txt AC 1 ms 256 KB
03_random09.txt AC 4 ms 256 KB
03_random10.txt AC 7 ms 256 KB
03_random11.txt AC 11 ms 256 KB
03_random12.txt AC 12 ms 256 KB
03_random13.txt AC 9 ms 256 KB
03_random14.txt AC 7 ms 256 KB
03_random15.txt AC 3 ms 256 KB
04_i.txt AC 181 ms 14080 KB
04_p1.txt AC 176 ms 14080 KB
04_p2.txt AC 144 ms 11264 KB
04_random01.txt AC 101 ms 8960 KB
04_random02.txt AC 79 ms 6784 KB
04_random03.txt AC 26 ms 1664 KB
04_random04.txt AC 29 ms 1408 KB
04_random05.txt AC 35 ms 2176 KB
04_random06.txt AC 107 ms 8960 KB
04_random07.txt AC 75 ms 6784 KB
04_random08.txt AC 64 ms 4608 KB
04_random09.txt AC 46 ms 4480 KB
04_random10.txt AC 106 ms 8960 KB
04_random11.txt AC 184 ms 14080 KB
04_random12.txt AC 182 ms 14080 KB
04_random13.txt AC 182 ms 14080 KB
04_rp01.txt AC 188 ms 14080 KB
04_rp02.txt AC 183 ms 14080 KB
04_rp03.txt AC 178 ms 14080 KB
04_rp04.txt AC 179 ms 14080 KB
04_rp05.txt AC 182 ms 14080 KB
04_rp06.txt AC 187 ms 14080 KB
04_rp07.txt AC 179 ms 14080 KB
04_rp08.txt AC 181 ms 14080 KB
04_rp09.txt AC 184 ms 14080 KB
04_rp10.txt AC 182 ms 14080 KB
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB