Submission #1779039
Source Code Expand
#include <iostream> #include <vector> using namespace std; int main(void){ int n, m, d; cin >> n >> m >> d; vector<int> amida(n+1); for (int i = 0; i < n; i++) amida[i+1] = i+1; vector<int> a(m); for (int i = 0; i < m; i++){ cin >> a[i]; } for (int i = m - 1; i >= 0; i--){ int temp = amida[a[i]]; amida[a[i]] = amida[a[i]+1]; amida[a[i]+1] = temp; } vector<int> par(n+1); vector< vector<int> > replace(0); for (int i = 1; i < n + 1; i++){ par[i] = i; } int num = 1; while (num <= n){ if (par[num] == num){ replace.push_back(vector<int>(0)); replace[replace.size()-1].push_back(num); int id = amida[num]; while (id != num){ par[id] = num; replace[replace.size()-1].push_back(id); id = amida[id]; } } num++; } for (int i = 0; i < replace.size(); i++){ int t = d % replace[i].size(); vector<int> c(replace[i].size()); c = replace[i]; for (int j = 0; j < t; j++){ int tmp = c[replace[i].size()-1]; for (int k = 0; k < replace[i].size() - 1; k++){ replace[i][k+1] = c[k]; } replace[i][0] = tmp; } for (int j = 0; j < replace[i].size(); j++){ amida[c[j]] = replace[i][j]; } } for (int i = 0; i < n; i++){ cout << amida[i+1] << endl; } /* vector<int> b(n+1), c(n+1); c = amida; for (int i = 0; i < d - 1; i++){ b = amida; for (int j = 0; j < n; j++){ b[j+1] = amida[c[j+1]]; } c = b; } for (int i = 0; i < n; i++){ cout << c[i+1] << endl; } */ return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 阿弥陀 |
User | h2929 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1571 Byte |
Status | WA |
Exec Time | 4203 ms |
Memory | 7856 KB |
Judge Result
Set Name | Subtask1 | Subtask2 | Subtask3 | Subtask4 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 10 | 0 / 20 | 0 / 20 | 0 / 50 | ||||||||||||||||||
Status |
|
|
|
|
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 | 220 ms | 7856 KB |
01_random01.txt | AC | 1 ms | 256 KB |
01_random02.txt | AC | 1 ms | 256 KB |
01_random03.txt | WA | 1 ms | 256 KB |
01_random04.txt | WA | 9 ms | 384 KB |
01_random05.txt | WA | 171 ms | 6324 KB |
01_random06.txt | WA | 204 ms | 4788 KB |
01_random07.txt | WA | 217 ms | 4788 KB |
02_i.txt | AC | 3 ms | 256 KB |
02_p.txt | WA | 3 ms | 256 KB |
02_random01.txt | AC | 1 ms | 256 KB |
02_random02.txt | AC | 1 ms | 256 KB |
02_random03.txt | WA | 3 ms | 256 KB |
02_random04.txt | AC | 3 ms | 256 KB |
02_random05.txt | WA | 7 ms | 384 KB |
02_random06.txt | WA | 24 ms | 640 KB |
02_random07.txt | WA | 45 ms | 1024 KB |
02_random08.txt | WA | 45 ms | 1024 KB |
02_rp01.txt | WA | 3 ms | 256 KB |
02_rp02.txt | WA | 3 ms | 256 KB |
02_rp03.txt | WA | 3 ms | 256 KB |
02_rp04.txt | WA | 3 ms | 256 KB |
02_rp05.txt | WA | 3 ms | 256 KB |
03_i.txt | AC | 1 ms | 256 KB |
03_random01.txt | AC | 4 ms | 256 KB |
03_random02.txt | AC | 32 ms | 1024 KB |
03_random03.txt | AC | 26 ms | 896 KB |
03_random04.txt | WA | 26 ms | 896 KB |
03_random05.txt | AC | 6 ms | 384 KB |
03_random06.txt | AC | 5 ms | 384 KB |
03_random07.txt | WA | 8 ms | 384 KB |
03_random08.txt | AC | 2 ms | 256 KB |
03_random09.txt | AC | 10 ms | 512 KB |
03_random10.txt | AC | 17 ms | 640 KB |
03_random11.txt | WA | 29 ms | 1024 KB |
03_random12.txt | WA | 31 ms | 1152 KB |
03_random13.txt | WA | 24 ms | 768 KB |
03_random14.txt | WA | 19 ms | 640 KB |
03_random15.txt | AC | 8 ms | 384 KB |
04_i.txt | AC | 222 ms | 7856 KB |
04_p1.txt | WA | 207 ms | 2688 KB |
04_p2.txt | WA | 160 ms | 2048 KB |
04_random01.txt | WA | 120 ms | 2744 KB |
04_random02.txt | WA | 85 ms | 2360 KB |
04_random03.txt | WA | 43 ms | 1024 KB |
04_random04.txt | WA | 60 ms | 1152 KB |
04_random05.txt | WA | 61 ms | 1280 KB |
04_random06.txt | WA | 121 ms | 3000 KB |
04_random07.txt | WA | 109 ms | 2108 KB |
04_random08.txt | WA | 94 ms | 1852 KB |
04_random09.txt | WA | 82 ms | 1536 KB |
04_random10.txt | WA | 114 ms | 3512 KB |
04_random11.txt | WA | 218 ms | 4788 KB |
04_random12.txt | WA | 214 ms | 4788 KB |
04_random13.txt | WA | 217 ms | 4788 KB |
04_rp01.txt | TLE | 4203 ms | 2296 KB |
04_rp02.txt | WA | 2625 ms | 2520 KB |
04_rp03.txt | WA | 1169 ms | 2500 KB |
04_rp04.txt | WA | 1538 ms | 2600 KB |
04_rp05.txt | WA | 1526 ms | 2508 KB |
04_rp06.txt | WA | 1345 ms | 2540 KB |
04_rp07.txt | WA | 874 ms | 2656 KB |
04_rp08.txt | WA | 1070 ms | 2608 KB |
04_rp09.txt | WA | 1043 ms | 2512 KB |
04_rp10.txt | WA | 1093 ms | 2600 KB |
sample_1.txt | WA | 1 ms | 256 KB |
sample_2.txt | WA | 1 ms | 256 KB |
sample_3.txt | AC | 1 ms | 256 KB |