Submission #214573


Source Code Expand

Copy
#include <bits/stdc++.h>

#define INF (1 << 29)
#define rep2(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) rep2(i,0,n)
#define EPS 1e-10

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

int dx[4] = {-1,0,1,0};
int dy[4] = {0,1,0,-1};

int dest[50][100010];
int tmp[100010];
int res[100010];

int main()
{
    int n,m,d;
    cin >> n >> m >> d;
    rep(i,n){
        dest[0][i]=i;
        tmp[i]=i;
    }
    rep(i,m){
        int a;
        cin >> a;
        a--;
        swap(tmp[a],tmp[a+1]);
    }
    rep(i,n){
        dest[0][tmp[i]]=i;
    }
    rep2(i,1,50){
        rep(j,n){
            dest[i][j]=dest[i-1][dest[i-1][j]];
        }
    }
    int pos = 0;
    rep(i,n) res[i]=i;
    while(d>0){
        while(!((1<<pos)&d)) pos++;
        rep(j,n){
            res[j]=dest[pos][res[j]];
        }
        d -= (1<<pos);
    }
    rep(i,n) cout << res[i]+1 << endl;
    return 0;
}

Submission Info

Submission Time
Task D - 阿弥陀
User garasubo
Language C++ (G++ 4.6.4)
Score 100
Code Size 1013 Byte
Status AC
Exec Time 540 ms
Memory 21676 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 540 ms 21620 KB
01_random01.txt AC 22 ms 980 KB
01_random02.txt AC 23 ms 992 KB
01_random03.txt AC 22 ms 924 KB
01_random04.txt AC 40 ms 1632 KB
01_random05.txt AC 455 ms 21672 KB
01_random06.txt AC 507 ms 21600 KB
01_random07.txt AC 538 ms 21664 KB
02_i.txt AC 26 ms 1184 KB
02_p.txt AC 26 ms 1316 KB
02_random01.txt AC 23 ms 972 KB
02_random02.txt AC 22 ms 988 KB
02_random03.txt AC 26 ms 1048 KB
02_random04.txt AC 25 ms 1312 KB
02_random05.txt AC 33 ms 1184 KB
02_random06.txt AC 61 ms 1188 KB
02_random07.txt AC 95 ms 1192 KB
02_random08.txt AC 95 ms 1180 KB
02_rp01.txt AC 26 ms 1188 KB
02_rp02.txt AC 24 ms 1184 KB
02_rp03.txt AC 26 ms 1308 KB
02_rp04.txt AC 26 ms 1124 KB
02_rp05.txt AC 26 ms 1304 KB
03_i.txt AC 21 ms 924 KB
03_random01.txt AC 25 ms 944 KB
03_random02.txt AC 70 ms 932 KB
03_random03.txt AC 61 ms 932 KB
03_random04.txt AC 59 ms 928 KB
03_random05.txt AC 30 ms 884 KB
03_random06.txt AC 27 ms 1056 KB
03_random07.txt AC 32 ms 932 KB
03_random08.txt AC 22 ms 928 KB
03_random09.txt AC 36 ms 932 KB
03_random10.txt AC 49 ms 988 KB
03_random11.txt AC 67 ms 940 KB
03_random12.txt AC 69 ms 932 KB
03_random13.txt AC 57 ms 932 KB
03_random14.txt AC 51 ms 932 KB
03_random15.txt AC 33 ms 932 KB
04_i.txt AC 538 ms 21676 KB
04_p1.txt AC 483 ms 21676 KB
04_p2.txt AC 396 ms 17432 KB
04_random01.txt AC 299 ms 12464 KB
04_random02.txt AC 229 ms 10152 KB
04_random03.txt AC 108 ms 3120 KB
04_random04.txt AC 133 ms 2728 KB
04_random05.txt AC 143 ms 3828 KB
04_random06.txt AC 313 ms 13488 KB
04_random07.txt AC 257 ms 8344 KB
04_random08.txt AC 223 ms 7208 KB
04_random09.txt AC 178 ms 4388 KB
04_random10.txt AC 302 ms 13608 KB
04_random11.txt AC 532 ms 21664 KB
04_random12.txt AC 526 ms 21672 KB
04_random13.txt AC 540 ms 21668 KB
04_rp01.txt AC 503 ms 21604 KB
04_rp02.txt AC 486 ms 21668 KB
04_rp03.txt AC 490 ms 21656 KB
04_rp04.txt AC 497 ms 21676 KB
04_rp05.txt AC 486 ms 21664 KB
04_rp06.txt AC 499 ms 21672 KB
04_rp07.txt AC 493 ms 21668 KB
04_rp08.txt AC 493 ms 21668 KB
04_rp09.txt AC 490 ms 21668 KB
04_rp10.txt AC 485 ms 21664 KB
sample_1.txt AC 22 ms 932 KB
sample_2.txt AC 20 ms 1056 KB
sample_3.txt AC 22 ms 1060 KB