Submission #993632
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; const int M = 200200; int n; int m; ll f[M]; ll a[M]; void read() { cin >> n; for (int i = 0; i < n - 1; ++i) cin >> a[i]; cin >> m; if (m > 1) { exit(0); } cin >> a[n - 1]; } void kill() { f[n - 1] = -a[n - 1]; ll best = f[n - 1]; for (int i = n - 2; i >= 1; --i) { best += a[i]; f[i] = -best; if (best > f[i]) best = f[i]; } cout << f[1] + a[0] << endl; } int main() { #ifdef LOCAL assert(freopen("h.in", "r", stdin)); #endif ios_base::sync_with_stdio(false); read(); kill(); }
Submission Info
Submission Time | |
---|---|
Task | H - Tokaido |
User | Arterm |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 688 Byte |
Status | WA |
Exec Time | 18 ms |
Memory | 3328 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 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 | AC | 17 ms | 3328 KB |
01-02.txt | AC | 3 ms | 256 KB |
01-03.txt | AC | 3 ms | 256 KB |
01-04.txt | AC | 10 ms | 1792 KB |
01-05.txt | AC | 17 ms | 3328 KB |
01-06.txt | AC | 17 ms | 3328 KB |
01-07.txt | AC | 7 ms | 1280 KB |
01-08.txt | AC | 17 ms | 3328 KB |
01-09.txt | AC | 17 ms | 3328 KB |
01-10.txt | AC | 2 ms | 256 KB |
01-11.txt | AC | 5 ms | 896 KB |
01-12.txt | AC | 17 ms | 3328 KB |
01-13.txt | AC | 18 ms | 3328 KB |
01-14.txt | AC | 17 ms | 3328 KB |
01-15.txt | AC | 18 ms | 3328 KB |
01-16.txt | AC | 18 ms | 3328 KB |
01-17.txt | AC | 18 ms | 3328 KB |
01-18.txt | AC | 18 ms | 3328 KB |
01-19.txt | AC | 18 ms | 3328 KB |
02-01.txt | WA | 5 ms | 512 KB |
02-02.txt | WA | 15 ms | 1792 KB |
02-03.txt | WA | 15 ms | 1792 KB |
02-04.txt | WA | 15 ms | 1792 KB |
02-05.txt | WA | 3 ms | 256 KB |
02-06.txt | WA | 16 ms | 1792 KB |
02-07.txt | WA | 16 ms | 1792 KB |
02-08.txt | WA | 2 ms | 256 KB |
02-09.txt | WA | 3 ms | 256 KB |
02-10.txt | WA | 9 ms | 1024 KB |
02-11.txt | WA | 16 ms | 1792 KB |
02-12.txt | WA | 16 ms | 1792 KB |
02-13.txt | WA | 16 ms | 1792 KB |
02-14.txt | WA | 16 ms | 1792 KB |
02-15.txt | WA | 16 ms | 1792 KB |
02-16.txt | WA | 16 ms | 1792 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | WA | 2 ms | 256 KB |