Submission #993810
Source Code Expand
#include <iostream> #include <fstream> #include <set> #include <map> #include <string> #include <vector> #include <bitset> #include <algorithm> #include <cstring> #include <cstdlib> #include <cmath> #include <cassert> #include <queue> #define mp make_pair #define pb push_back typedef long long ll; typedef long double ld; using namespace std; int n; int a[220000]; ll solve() { ll mx = a[n - 1]; for (int i = n - 2; i >= 2; --i) { mx -= a[i]; mx = max(mx, -mx); } return a[0] - a[1] + mx; } int main() { scanf("%d", &n); for (int i = 0; i < n - 1; ++i) scanf("%d", a + i); int m; scanf("%d", &m); assert(m <= 10); for (int i = 0; i < m; ++i) { scanf("%d", a + n - 1); printf("%lld\n", solve()); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | H - Tokaido |
User | LHiC |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 791 Byte |
Status | RE |
Exec Time | 126 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:37:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:39:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", a + i); ^ ./Main.cpp:41:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &m); ^ ./Main.cpp:44:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", a + n - 1); ^
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 | 18 ms | 1024 KB |
01-02.txt | AC | 2 ms | 256 KB |
01-03.txt | AC | 2 ms | 256 KB |
01-04.txt | AC | 10 ms | 640 KB |
01-05.txt | AC | 18 ms | 1024 KB |
01-06.txt | AC | 18 ms | 1024 KB |
01-07.txt | AC | 7 ms | 512 KB |
01-08.txt | AC | 18 ms | 1024 KB |
01-09.txt | AC | 19 ms | 1024 KB |
01-10.txt | AC | 2 ms | 256 KB |
01-11.txt | AC | 5 ms | 384 KB |
01-12.txt | AC | 18 ms | 1024 KB |
01-13.txt | AC | 19 ms | 1024 KB |
01-14.txt | AC | 18 ms | 1024 KB |
01-15.txt | AC | 19 ms | 1024 KB |
01-16.txt | AC | 18 ms | 1024 KB |
01-17.txt | AC | 19 ms | 1024 KB |
01-18.txt | AC | 19 ms | 1024 KB |
01-19.txt | AC | 18 ms | 1024 KB |
02-01.txt | RE | 112 ms | 384 KB |
02-02.txt | RE | 125 ms | 1024 KB |
02-03.txt | RE | 125 ms | 1024 KB |
02-04.txt | RE | 125 ms | 1024 KB |
02-05.txt | RE | 109 ms | 256 KB |
02-06.txt | RE | 125 ms | 1024 KB |
02-07.txt | RE | 124 ms | 1024 KB |
02-08.txt | RE | 109 ms | 256 KB |
02-09.txt | RE | 110 ms | 256 KB |
02-10.txt | RE | 118 ms | 640 KB |
02-11.txt | RE | 125 ms | 1024 KB |
02-12.txt | RE | 125 ms | 1024 KB |
02-13.txt | RE | 126 ms | 1024 KB |
02-14.txt | RE | 126 ms | 1024 KB |
02-15.txt | RE | 126 ms | 1024 KB |
02-16.txt | RE | 125 ms | 1024 KB |
sample-01.txt | AC | 2 ms | 256 KB |
sample-02.txt | AC | 2 ms | 256 KB |