Submission #655577
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 ); } } 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 | 1162 Byte |
Status | WA |
Exec Time | 117 ms |
Memory | 9068 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:37: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:39: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 | 112 ms | 8956 KB |
01_random01.txt | AC | 28 ms | 920 KB |
01_random02.txt | AC | 29 ms | 920 KB |
01_random03.txt | AC | 27 ms | 880 KB |
01_random04.txt | AC | 30 ms | 1200 KB |
01_random05.txt | AC | 105 ms | 8744 KB |
01_random06.txt | WA | 110 ms | 9044 KB |
01_random07.txt | WA | 117 ms | 9028 KB |
02_i.txt | AC | 28 ms | 1048 KB |
02_p.txt | AC | 28 ms | 996 KB |
02_random01.txt | AC | 26 ms | 920 KB |
02_random02.txt | AC | 26 ms | 880 KB |
02_random03.txt | AC | 28 ms | 1052 KB |
02_random04.txt | AC | 27 ms | 1004 KB |
02_random05.txt | AC | 28 ms | 1004 KB |
02_random06.txt | AC | 43 ms | 1388 KB |
02_random07.txt | WA | 41 ms | 1384 KB |
02_random08.txt | WA | 40 ms | 1384 KB |
02_rp01.txt | AC | 26 ms | 1048 KB |
02_rp02.txt | AC | 25 ms | 1048 KB |
02_rp03.txt | AC | 27 ms | 1012 KB |
02_rp04.txt | AC | 27 ms | 1000 KB |
02_rp05.txt | AC | 27 ms | 1008 KB |
03_i.txt | AC | 25 ms | 916 KB |
03_random01.txt | AC | 28 ms | 1004 KB |
03_random02.txt | AC | 40 ms | 1256 KB |
03_random03.txt | WA | 41 ms | 1260 KB |
03_random04.txt | WA | 39 ms | 1256 KB |
03_random05.txt | AC | 30 ms | 1000 KB |
03_random06.txt | AC | 30 ms | 976 KB |
03_random07.txt | WA | 32 ms | 1012 KB |
03_random08.txt | WA | 27 ms | 880 KB |
03_random09.txt | WA | 34 ms | 1132 KB |
03_random10.txt | WA | 40 ms | 1260 KB |
03_random11.txt | WA | 41 ms | 1260 KB |
03_random12.txt | WA | 40 ms | 1264 KB |
03_random13.txt | WA | 39 ms | 1260 KB |
03_random14.txt | WA | 40 ms | 1256 KB |
03_random15.txt | WA | 32 ms | 1136 KB |
04_i.txt | WA | 113 ms | 9068 KB |
04_p1.txt | WA | 110 ms | 8944 KB |
04_p2.txt | WA | 92 ms | 7404 KB |
04_random01.txt | WA | 78 ms | 5608 KB |
04_random02.txt | WA | 60 ms | 4584 KB |
04_random03.txt | WA | 46 ms | 2152 KB |
04_random04.txt | WA | 46 ms | 1896 KB |
04_random05.txt | WA | 47 ms | 2284 KB |
04_random06.txt | WA | 80 ms | 5868 KB |
04_random07.txt | WA | 63 ms | 4076 KB |
04_random08.txt | WA | 61 ms | 3692 KB |
04_random09.txt | WA | 49 ms | 2668 KB |
04_random10.txt | WA | 75 ms | 5864 KB |
04_random11.txt | WA | 109 ms | 9024 KB |
04_random12.txt | WA | 113 ms | 9036 KB |
04_random13.txt | WA | 110 ms | 9024 KB |
04_rp01.txt | WA | 110 ms | 9028 KB |
04_rp02.txt | WA | 113 ms | 9064 KB |
04_rp03.txt | WA | 110 ms | 9060 KB |
04_rp04.txt | WA | 110 ms | 9064 KB |
04_rp05.txt | WA | 113 ms | 9068 KB |
04_rp06.txt | WA | 112 ms | 9064 KB |
04_rp07.txt | WA | 112 ms | 8940 KB |
04_rp08.txt | WA | 112 ms | 9068 KB |
04_rp09.txt | WA | 112 ms | 9064 KB |
04_rp10.txt | WA | 112 ms | 9056 KB |
sample_1.txt | AC | 26 ms | 936 KB |
sample_2.txt | AC | 28 ms | 876 KB |
sample_3.txt | AC | 29 ms | 912 KB |