Submission #6504537
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 100005; ll X[MAXN],Y[MAXN]; int g[MAXN],fn[MAXN]; bool vis[MAXN]; int main() { ios::sync_with_stdio(0); int n; cin >> n; for(int i=1;i<=n;i++) cin >> X[i]; for(int i=n;i;i--) { X[i] = X[i] - X[i-1]; g[i] = i; } int m; ll K; cin >> m >> K; for(int i=1;i<=m;i++) { int pos; cin >> pos; swap(g[pos] , g[pos+1]); } for(int i=1;i<=n;i++) if(vis[i] == false) { static int st[MAXN]; int cnt = 0; for(int j=i;vis[j] == false;j=g[j]) { st[cnt++] = j; vis[j] = true; } for(int j=0;j<cnt;j++) fn[st[j]] = st[(j+K)%cnt]; } for(int i=1;i<=n;i++) Y[fn[i]] = X[i]; for(int i=1;i<=n;i++) { Y[i] += Y[i-1]; cout << Y[i] << ".0\n"; } }
Submission Info
Submission Time | |
---|---|
Task | C - Rabbit Exercise |
User | j31234 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 817 Byte |
Status | WA |
Exec Time | 31 ms |
Memory | 4352 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 23 ms | 3968 KB |
1_03.txt | WA | 31 ms | 4352 KB |
1_04.txt | WA | 24 ms | 2944 KB |
1_05.txt | WA | 3 ms | 256 KB |
1_06.txt | WA | 6 ms | 256 KB |
1_07.txt | WA | 4 ms | 256 KB |
1_08.txt | WA | 6 ms | 384 KB |
1_09.txt | WA | 6 ms | 384 KB |
1_10.txt | WA | 2 ms | 256 KB |
1_11.txt | WA | 4 ms | 256 KB |
1_12.txt | WA | 1 ms | 256 KB |
1_13.txt | WA | 7 ms | 256 KB |
1_14.txt | WA | 4 ms | 256 KB |
1_15.txt | WA | 9 ms | 640 KB |
1_16.txt | WA | 3 ms | 512 KB |
1_17.txt | WA | 18 ms | 1792 KB |
1_18.txt | WA | 21 ms | 2176 KB |
1_19.txt | WA | 25 ms | 2816 KB |
1_20.txt | WA | 13 ms | 1024 KB |
1_21.txt | WA | 14 ms | 1280 KB |
1_22.txt | WA | 25 ms | 2816 KB |
1_23.txt | WA | 22 ms | 3328 KB |
1_24.txt | WA | 16 ms | 2560 KB |
1_25.txt | AC | 24 ms | 3072 KB |