Submission #1003506
Source Code Expand
import std.stdio; import std.string; import std.conv; import std.typecons; import std.algorithm; import std.functional; import std.bigint; import std.numeric; import std.array; import std.math; import std.range; import std.container; import std.ascii; import std.traits; void times(alias fun)(int n) { foreach(i; 0..n) fun(); } auto rep(alias fun, T = typeof(fun()))(int n) { T[] res = new T[n]; foreach(ref e; res) e = fun(); return res; } // fold was added in D 2.071.0. template fold(fun...) if (fun.length >= 1) { auto fold(R, S...)(R r, S seed) { static if (S.length < 2) { return reduce!fun(seed, r); } else { return reduce!fun(tuple(seed), r); } } } int MAX = 10^^6+1; void main() { int N = readln.chomp.to!int; int[] a = readln.split.to!(int[]); auto list = DList!int(MAX.iota); iota(2, N-1).each!(i => list[].drop(1).take(a[i]).each!(v => list.insertFront(v))); int[] ary = list[].array; int s = a[2..$].sum; int M = readln.chomp.to!int; foreach(_; 0..M) { int x = readln.chomp.to!int; writeln((x<MAX ? ary[x] : x-s) + a[0] - a[1]); } }
Submission Info
Submission Time | |
---|---|
Task | H - Tokaido |
User | arkark |
Language | D (DMD64 v2.070.1) |
Score | 1600 |
Code Size | 1220 Byte |
Status | AC |
Exec Time | 585 ms |
Memory | 88812 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | 900 / 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 | AC | 504 ms | 83820 KB |
01-02.txt | AC | 197 ms | 36476 KB |
01-03.txt | AC | 449 ms | 76796 KB |
01-04.txt | AC | 384 ms | 74876 KB |
01-05.txt | AC | 504 ms | 83820 KB |
01-06.txt | AC | 507 ms | 83820 KB |
01-07.txt | AC | 456 ms | 76796 KB |
01-08.txt | AC | 505 ms | 83804 KB |
01-09.txt | AC | 504 ms | 83804 KB |
01-10.txt | AC | 417 ms | 72700 KB |
01-11.txt | AC | 454 ms | 76796 KB |
01-12.txt | AC | 505 ms | 83716 KB |
01-13.txt | AC | 504 ms | 83828 KB |
01-14.txt | AC | 502 ms | 83832 KB |
01-15.txt | AC | 507 ms | 83828 KB |
01-16.txt | AC | 501 ms | 83828 KB |
01-17.txt | AC | 209 ms | 40948 KB |
01-18.txt | AC | 209 ms | 40948 KB |
01-19.txt | AC | 209 ms | 40948 KB |
02-01.txt | AC | 463 ms | 77436 KB |
02-02.txt | AC | 583 ms | 88812 KB |
02-03.txt | AC | 577 ms | 87404 KB |
02-04.txt | AC | 579 ms | 87276 KB |
02-05.txt | AC | 525 ms | 80636 KB |
02-06.txt | AC | 576 ms | 87388 KB |
02-07.txt | AC | 580 ms | 87516 KB |
02-08.txt | AC | 497 ms | 77180 KB |
02-09.txt | AC | 524 ms | 81148 KB |
02-10.txt | AC | 458 ms | 79356 KB |
02-11.txt | AC | 585 ms | 88308 KB |
02-12.txt | AC | 579 ms | 88188 KB |
02-13.txt | AC | 583 ms | 88180 KB |
02-14.txt | AC | 583 ms | 88308 KB |
02-15.txt | AC | 285 ms | 45684 KB |
02-16.txt | AC | 285 ms | 45684 KB |
sample-01.txt | AC | 198 ms | 36476 KB |
sample-02.txt | AC | 197 ms | 36476 KB |