Submission #3957040
Source Code Expand
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; const int N=1000010; int v[N]; inline int gi() { int x=0,o=1; char ch=getchar(); while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar(); while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(); return o*x; } int main() { int n,q,tp=0,la=0,pre; cin>>n,pre=gi()-gi(); for(int i=3;i<n;i++) { int x=gi(); for(int j=1;j<=x;j++) { if(la-j<=0) v[++tp]=j-la; else v[++tp]=v[la-j]; } la+=x; } cin>>q; while(q--) { int x=gi()-la; if(x<-la) x=-la*2-x; printf("%d\n",(x>=0?x:v[-x])+pre); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | H - Tokaido |
User | vjudge5 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 664 Byte |
Status | RE |
Exec Time | 3 ms |
Memory | 556 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, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | RE | 3 ms | 548 KB |
01-02.txt | RE | 3 ms | 548 KB |
01-03.txt | RE | 3 ms | 548 KB |
01-04.txt | RE | 3 ms | 544 KB |
01-05.txt | RE | 3 ms | 548 KB |
01-06.txt | RE | 3 ms | 548 KB |
01-07.txt | RE | 3 ms | 556 KB |
01-08.txt | RE | 3 ms | 556 KB |
01-09.txt | RE | 3 ms | 556 KB |
01-10.txt | RE | 3 ms | 548 KB |
01-11.txt | RE | 3 ms | 548 KB |
01-12.txt | RE | 3 ms | 556 KB |
01-13.txt | RE | 3 ms | 548 KB |
01-14.txt | RE | 3 ms | 548 KB |
01-15.txt | RE | 3 ms | 548 KB |
01-16.txt | RE | 3 ms | 556 KB |
01-17.txt | RE | 3 ms | 548 KB |
01-18.txt | RE | 3 ms | 548 KB |
01-19.txt | RE | 3 ms | 548 KB |
02-01.txt | RE | 3 ms | 556 KB |
02-02.txt | RE | 3 ms | 556 KB |
02-03.txt | RE | 3 ms | 548 KB |
02-04.txt | RE | 3 ms | 548 KB |
02-05.txt | RE | 3 ms | 552 KB |
02-06.txt | RE | 3 ms | 552 KB |
02-07.txt | RE | 3 ms | 556 KB |
02-08.txt | RE | 3 ms | 548 KB |
02-09.txt | RE | 3 ms | 548 KB |
02-10.txt | RE | 3 ms | 552 KB |
02-11.txt | RE | 3 ms | 548 KB |
02-12.txt | RE | 3 ms | 544 KB |
02-13.txt | RE | 3 ms | 548 KB |
02-14.txt | RE | 3 ms | 544 KB |
02-15.txt | RE | 3 ms | 544 KB |
02-16.txt | RE | 3 ms | 548 KB |
sample-01.txt | RE | 3 ms | 548 KB |
sample-02.txt | RE | 3 ms | 548 KB |