Submission #3453326
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main (){ int n; cin >> n; long long a[n]={}; cin >> a[0]; for(int i=1; i<n; i++) { int j; cin >> j; a[i] = a[i-1] + j; } long long b[n] ={}; cin >> b[0]; for(int i=1; i<n; i++){ int j; cin >> j; b[i] = b[i-1] + j; } long long c[n] = {}; c[0] = b[n-1]; for(int i=1; i<n; i++) c[i] = b[n-1]-b[i-1]; long long ans=0; for(int i=0; i<n; i++){ ans = ans > a[i] + c[i] ? ans: a[i] + c[i]; } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | C - Candies |
User | ttrr |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 629 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample01.txt, sample02.txt, sample03.txt, sample04.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample01.txt, sample02.txt, sample03.txt, sample04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 1 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
sample01.txt | AC | 1 ms | 256 KB |
sample02.txt | AC | 1 ms | 256 KB |
sample03.txt | AC | 1 ms | 256 KB |
sample04.txt | AC | 1 ms | 256 KB |