Submission #214100


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define all(c) begin(c),end(c)
using namespace std;


int main(){
    int n,m,d;
    cin >> n >> m >> d;
    vector<int> a(m);
    rep(i,m) cin >> a[i];

    vector<int> e(n);
    rep(i,n) e[i] = i;

    vector<int> sub = e;
    for(int i = m-1; i >= 0; i--){
        swap(sub[a[i]-1], sub[a[i]]);
    }


    vector<int> ans = e;
    vector<int> coe = sub;
    while(d > 0){
        vector<int> tmp(n);
        if(d & 1){
            rep(i,n) tmp[i] = ans[coe[i]];
            swap(ans,tmp);
        }
        rep(i,n) tmp[i] = coe[coe[i]];
        swap(coe,tmp);
        d >>= 1;
    }
    rep(i,n) cout << ans[i]+1 << endl;
}

Submission Info

Submission Time
Task D - 阿弥陀
User eha
Language C++11 (GCC 4.8.1)
Score 100
Code Size 740 Byte
Status AC
Exec Time 506 ms
Memory 4104 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 496 ms 3668 KB
01_random01.txt AC 22 ms 920 KB
01_random02.txt AC 20 ms 800 KB
01_random03.txt AC 20 ms 928 KB
01_random04.txt AC 36 ms 792 KB
01_random05.txt AC 426 ms 2976 KB
01_random06.txt AC 483 ms 3476 KB
01_random07.txt AC 497 ms 3672 KB
02_i.txt AC 24 ms 928 KB
02_p.txt AC 24 ms 804 KB
02_random01.txt AC 21 ms 804 KB
02_random02.txt AC 21 ms 928 KB
02_random03.txt AC 25 ms 800 KB
02_random04.txt AC 25 ms 920 KB
02_random05.txt AC 31 ms 924 KB
02_random06.txt AC 59 ms 1184 KB
02_random07.txt AC 96 ms 1572 KB
02_random08.txt AC 98 ms 1572 KB
02_rp01.txt AC 26 ms 732 KB
02_rp02.txt AC 26 ms 876 KB
02_rp03.txt AC 25 ms 748 KB
02_rp04.txt AC 24 ms 748 KB
02_rp05.txt AC 26 ms 920 KB
03_i.txt AC 20 ms 928 KB
03_random01.txt AC 26 ms 924 KB
03_random02.txt AC 70 ms 1448 KB
03_random03.txt AC 63 ms 1432 KB
03_random04.txt AC 61 ms 1372 KB
03_random05.txt AC 28 ms 928 KB
03_random06.txt AC 30 ms 932 KB
03_random07.txt AC 33 ms 944 KB
03_random08.txt AC 22 ms 928 KB
03_random09.txt AC 37 ms 1004 KB
03_random10.txt AC 49 ms 1136 KB
03_random11.txt AC 66 ms 1564 KB
03_random12.txt AC 70 ms 1456 KB
03_random13.txt AC 56 ms 1432 KB
03_random14.txt AC 51 ms 1304 KB
03_random15.txt AC 32 ms 1052 KB
04_i.txt AC 499 ms 4104 KB
04_p1.txt AC 455 ms 3728 KB
04_p2.txt AC 372 ms 3016 KB
04_random01.txt AC 282 ms 2584 KB
04_random02.txt AC 218 ms 2072 KB
04_random03.txt AC 103 ms 1440 KB
04_random04.txt AC 128 ms 1696 KB
04_random05.txt AC 138 ms 1700 KB
04_random06.txt AC 297 ms 2652 KB
04_random07.txt AC 244 ms 2432 KB
04_random08.txt AC 210 ms 2084 KB
04_random09.txt AC 170 ms 1956 KB
04_random10.txt AC 289 ms 2508 KB
04_random11.txt AC 503 ms 4096 KB
04_random12.txt AC 506 ms 4096 KB
04_random13.txt AC 503 ms 4104 KB
04_rp01.txt AC 458 ms 3596 KB
04_rp02.txt AC 462 ms 3848 KB
04_rp03.txt AC 468 ms 3592 KB
04_rp04.txt AC 460 ms 3720 KB
04_rp05.txt AC 464 ms 3724 KB
04_rp06.txt AC 460 ms 3724 KB
04_rp07.txt AC 461 ms 3724 KB
04_rp08.txt AC 459 ms 3660 KB
04_rp09.txt AC 462 ms 3656 KB
04_rp10.txt AC 468 ms 3596 KB
sample_1.txt AC 20 ms 808 KB
sample_2.txt AC 21 ms 800 KB
sample_3.txt AC 20 ms 800 KB