Contest Duration: - (local time) (120 minutes) Back to Home

Submission #214125

Source Code Expand

Copy
```#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <stdint.h>
using namespace std;

vector<int> vpow(const vector<int> &v, int i)
{
int n = v.size();
if (i==0){
vector<int> ret(n);
for (int i=0;i<n;i++)
ret[i]=i;
return ret;
}
if (i==1){
return v;
}

vector<int> w = vpow(v, i/2);
vector<int> w2(n);

for (int j=0;j<n;j++)
w2[j]=w[w[j]];

vector<int> ret(n);
if (i%2==1){
for (int j=0;j<n;j++)
ret[j]=v[w2[j]];
}
else{
ret = w2;
}

return ret;
}

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

vector<int> amd(n);
for (int i=0;i<n;i++) amd[i]=i;

for (int i=0;i<m;i++){
int p; cin>>p;
swap(amd[p-1], amd[p]);
}

vector<int> ans = vpow(amd, d);
vector<int> rev(n);
for (int i=0;i<n;i++)
rev[ans[i]] = i;

for (int i=0;i<n;i++){
cout << rev[i]+1 << endl;
}

return 0;
}
```

#### Submission Info

Submission Time 2014-08-16 21:43:28+0900 D - 阿弥陀 tanakh C++ (G++ 4.6.4) 100 1017 Byte AC 526 ms 3340 KB

#### Judge Result

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 488 ms 2652 KB
01_random01.txt AC 24 ms 792 KB
01_random02.txt AC 21 ms 920 KB
01_random03.txt AC 20 ms 800 KB
01_random04.txt AC 36 ms 804 KB
01_random05.txt AC 416 ms 2468 KB
01_random06.txt AC 476 ms 2460 KB
01_random07.txt AC 493 ms 2464 KB
02_i.txt AC 24 ms 924 KB
02_p.txt AC 25 ms 804 KB
02_random01.txt AC 21 ms 800 KB
02_random02.txt AC 20 ms 928 KB
02_random03.txt AC 25 ms 924 KB
02_random04.txt AC 25 ms 928 KB
02_random05.txt AC 31 ms 796 KB
02_random06.txt AC 58 ms 792 KB
02_random07.txt AC 91 ms 760 KB
02_random08.txt AC 93 ms 804 KB
02_rp01.txt AC 25 ms 920 KB
02_rp02.txt AC 25 ms 800 KB
02_rp03.txt AC 25 ms 928 KB
02_rp04.txt AC 24 ms 924 KB
02_rp05.txt AC 25 ms 804 KB
03_i.txt AC 21 ms 804 KB
03_random01.txt AC 24 ms 788 KB
03_random02.txt AC 66 ms 796 KB
03_random03.txt AC 59 ms 804 KB
03_random04.txt AC 59 ms 800 KB
03_random05.txt AC 27 ms 800 KB
03_random06.txt AC 27 ms 808 KB
03_random07.txt AC 32 ms 800 KB
03_random08.txt AC 21 ms 804 KB
03_random09.txt AC 34 ms 804 KB
03_random10.txt AC 47 ms 804 KB
03_random11.txt AC 66 ms 920 KB
03_random12.txt AC 68 ms 812 KB
03_random13.txt AC 57 ms 812 KB
03_random14.txt AC 50 ms 916 KB
03_random15.txt AC 32 ms 804 KB
04_i.txt AC 516 ms 3320 KB
04_p1.txt AC 468 ms 3196 KB
04_p2.txt AC 374 ms 2764 KB
04_random01.txt AC 288 ms 2116 KB
04_random02.txt AC 220 ms 1892 KB
04_random03.txt AC 105 ms 936 KB
04_random04.txt AC 127 ms 928 KB
04_random05.txt AC 137 ms 1044 KB
04_random06.txt AC 308 ms 2284 KB
04_random07.txt AC 244 ms 1652 KB
04_random08.txt AC 213 ms 1440 KB
04_random09.txt AC 176 ms 1176 KB
04_random10.txt AC 292 ms 2264 KB
04_random11.txt AC 526 ms 3260 KB
04_random12.txt AC 523 ms 3328 KB
04_random13.txt AC 509 ms 3324 KB
04_rp01.txt AC 468 ms 3328 KB
04_rp02.txt AC 472 ms 3328 KB
04_rp03.txt AC 466 ms 3280 KB
04_rp04.txt AC 475 ms 3208 KB
04_rp05.txt AC 465 ms 3328 KB
04_rp06.txt AC 465 ms 3340 KB
04_rp07.txt AC 475 ms 3328 KB
04_rp08.txt AC 467 ms 3324 KB
04_rp09.txt AC 473 ms 3204 KB
04_rp10.txt AC 470 ms 3328 KB
sample_1.txt AC 22 ms 804 KB
sample_2.txt AC 26 ms 800 KB
sample_3.txt AC 21 ms 732 KB