Submission #655583
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MAXM = 1e5 + 5; const int MAXD = 1e9 + 9; const int LGN = 20; // 2 ^ 19 > 1e5 int n, m, d; int a[ MAXN ]; int t[ LGN ][ MAXN ]; // terminal node when starting from node j, after playing 2 ^ i games void solve(){ for(int i = 1; i <= n; ++i) t[ 0 ][ i ] = i; // if there are no horizontal lines, it will go to itself for(int i = m - 1; i >= 0; --i) // lines are given from top to bottom swap<int>( t[ 0 ][ a[ i ] ], t[ 0 ][ a[ i ] + 1 ] ); for(int i = 1; i < LGN; ++i) for(int j = 1; j <= n; ++j){ int k = t[ i - 1 ][ j ]; t[ i ][ j ] = t[ i - 1 ][ k ]; } for(int i = 1; i <= n; ++i){ int u = i; int td = d; for(int k = LGN - 1; k >= 0; --k){ if( td >= ( 1 << k ) ){ u = t[ k ][ u ]; td -= ( 1 << k ); } } assert( u ); printf("%d\n", u); } } int main(){ scanf("%d%d%d", &n, &m, &d); for(int i = 0; i < m; ++i) scanf("%d", &a[ i ]); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 阿弥陀 |
User | Ow1 |
Language | C++11 (GCC 4.8.1) |
Score | 0 |
Code Size | 1184 Byte |
Status | WA |
Exec Time | 120 ms |
Memory | 9124 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:38:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d%d", &n, &m, &d); ^ ./Main.cpp:40:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &a[ i ]); ^
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 | WA | 117 ms | 9060 KB |
01_random01.txt | AC | 29 ms | 1056 KB |
01_random02.txt | AC | 28 ms | 1060 KB |
01_random03.txt | AC | 26 ms | 1052 KB |
01_random04.txt | AC | 29 ms | 1308 KB |
01_random05.txt | AC | 106 ms | 8992 KB |
01_random06.txt | WA | 117 ms | 9080 KB |
01_random07.txt | WA | 117 ms | 9076 KB |
02_i.txt | AC | 29 ms | 1064 KB |
02_p.txt | AC | 27 ms | 1052 KB |
02_random01.txt | AC | 28 ms | 928 KB |
02_random02.txt | AC | 28 ms | 996 KB |
02_random03.txt | AC | 28 ms | 1176 KB |
02_random04.txt | AC | 27 ms | 1052 KB |
02_random05.txt | AC | 30 ms | 1136 KB |
02_random06.txt | AC | 45 ms | 1564 KB |
02_random07.txt | WA | 44 ms | 1392 KB |
02_random08.txt | WA | 42 ms | 1452 KB |
02_rp01.txt | AC | 26 ms | 1044 KB |
02_rp02.txt | AC | 29 ms | 1044 KB |
02_rp03.txt | AC | 28 ms | 1048 KB |
02_rp04.txt | AC | 29 ms | 1060 KB |
02_rp05.txt | AC | 29 ms | 1180 KB |
03_i.txt | AC | 33 ms | 1048 KB |
03_random01.txt | AC | 36 ms | 1052 KB |
03_random02.txt | AC | 46 ms | 1396 KB |
03_random03.txt | WA | 44 ms | 1400 KB |
03_random04.txt | WA | 43 ms | 1320 KB |
03_random05.txt | AC | 34 ms | 1180 KB |
03_random06.txt | AC | 33 ms | 1144 KB |
03_random07.txt | WA | 34 ms | 1140 KB |
03_random08.txt | WA | 30 ms | 1124 KB |
03_random09.txt | WA | 38 ms | 1376 KB |
03_random10.txt | WA | 42 ms | 1440 KB |
03_random11.txt | WA | 42 ms | 1388 KB |
03_random12.txt | WA | 43 ms | 1444 KB |
03_random13.txt | WA | 42 ms | 1396 KB |
03_random14.txt | WA | 47 ms | 1368 KB |
03_random15.txt | WA | 36 ms | 1192 KB |
04_i.txt | WA | 112 ms | 9072 KB |
04_p1.txt | WA | 118 ms | 9080 KB |
04_p2.txt | WA | 98 ms | 7536 KB |
04_random01.txt | WA | 83 ms | 5668 KB |
04_random02.txt | WA | 62 ms | 4648 KB |
04_random03.txt | WA | 53 ms | 2168 KB |
04_random04.txt | WA | 48 ms | 2040 KB |
04_random05.txt | WA | 53 ms | 2440 KB |
04_random06.txt | WA | 84 ms | 6008 KB |
04_random07.txt | WA | 66 ms | 4084 KB |
04_random08.txt | WA | 65 ms | 3812 KB |
04_random09.txt | WA | 54 ms | 2680 KB |
04_random10.txt | WA | 80 ms | 5924 KB |
04_random11.txt | WA | 118 ms | 9076 KB |
04_random12.txt | WA | 115 ms | 9072 KB |
04_random13.txt | WA | 116 ms | 9112 KB |
04_rp01.txt | WA | 120 ms | 9056 KB |
04_rp02.txt | WA | 118 ms | 9076 KB |
04_rp03.txt | WA | 117 ms | 9124 KB |
04_rp04.txt | WA | 116 ms | 9076 KB |
04_rp05.txt | WA | 118 ms | 9076 KB |
04_rp06.txt | WA | 117 ms | 9080 KB |
04_rp07.txt | WA | 118 ms | 9080 KB |
04_rp08.txt | WA | 119 ms | 9052 KB |
04_rp09.txt | WA | 116 ms | 9080 KB |
04_rp10.txt | WA | 117 ms | 9076 KB |
sample_1.txt | AC | 30 ms | 1060 KB |
sample_2.txt | AC | 28 ms | 1056 KB |
sample_3.txt | AC | 30 ms | 1056 KB |