Submission #1007124
Source Code Expand
#include<iostream> #include<string> #include<vector> #include<map> #include<algorithm> #include<cmath> #include<set> #include<deque> using namespace std; const int ma = 1000009; int ans[1000010]; int main(){ int N; int64_t A[100001]; cin>>N; for(int i=1;i<N;i++){ cin>>A[i]; } int sum=0; for(int i=3;i<N;i++){ sum += A[i]; } deque<int> dq; for(int i=0;i<=ma;i++){ dq.push_back(i); } for(int i=3;i<N;i++){ int z; deque<int> tmp1; deque<int> tmp2; z=dq.front(); dq.pop_front(); for(int j=1;j<=A[i];j++){ int x=dq.front(); dq.pop_front(); tmp1.push_back(x); tmp2.push_back(x); } for(int j=0;j<A[i];j++){ int x=tmp1.back(); tmp1.pop_back(); dq.push_front(x); } dq.push_front(z); for(int j=0;j<A[i];j++){ int x=tmp2.front(); tmp2.pop_front(); dq.push_front(x); } } for(int i=0;i<=ma;i++){ ans[i]=dq.front(); dq.pop_front(); } int M; cin>>M; int s = A[1]-A[2]; for(int i=0;i<M;i++){ int x; cin>>x; if(x>ma){ cout<< x - sum + s <<endl; }else{ cout<<ans[x]+s <<endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | H - Tokaido |
User | cocococoa |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1415 Byte |
Status | RE |
Exec Time | 978 ms |
Memory | 11788 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | 0 / 900 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
dataset1 | sample-01.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt |
dataset2 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | RE | 128 ms | 1024 KB |
01-02.txt | AC | 16 ms | 8192 KB |
01-03.txt | AC | 30 ms | 8800 KB |
01-04.txt | AC | 62 ms | 9492 KB |
01-05.txt | RE | 126 ms | 1024 KB |
01-06.txt | RE | 126 ms | 1024 KB |
01-07.txt | AC | 50 ms | 9236 KB |
01-08.txt | RE | 127 ms | 1024 KB |
01-09.txt | RE | 127 ms | 1024 KB |
01-10.txt | AC | 30 ms | 9960 KB |
01-11.txt | AC | 42 ms | 10804 KB |
01-12.txt | RE | 127 ms | 1024 KB |
01-13.txt | RE | 128 ms | 1024 KB |
01-14.txt | RE | 127 ms | 1024 KB |
01-15.txt | RE | 127 ms | 1024 KB |
01-16.txt | RE | 127 ms | 1024 KB |
01-17.txt | RE | 127 ms | 1024 KB |
01-18.txt | RE | 128 ms | 1024 KB |
01-19.txt | RE | 127 ms | 1024 KB |
02-01.txt | AC | 152 ms | 9068 KB |
02-02.txt | RE | 127 ms | 1024 KB |
02-03.txt | RE | 127 ms | 1024 KB |
02-04.txt | RE | 126 ms | 1024 KB |
02-05.txt | AC | 961 ms | 9284 KB |
02-06.txt | RE | 127 ms | 1024 KB |
02-07.txt | RE | 128 ms | 1024 KB |
02-08.txt | AC | 946 ms | 11316 KB |
02-09.txt | AC | 940 ms | 10380 KB |
02-10.txt | AC | 978 ms | 11788 KB |
02-11.txt | RE | 128 ms | 1024 KB |
02-12.txt | RE | 127 ms | 1024 KB |
02-13.txt | RE | 128 ms | 1024 KB |
02-14.txt | RE | 128 ms | 1024 KB |
02-15.txt | RE | 127 ms | 1024 KB |
02-16.txt | RE | 128 ms | 1024 KB |
sample-01.txt | AC | 16 ms | 8192 KB |
sample-02.txt | AC | 16 ms | 8192 KB |