Submission #3603166
Source Code Expand
#include<cstdio> #include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<queue> #include<string> #include<vector> #include<float.h> #include<math.h> #include<map> #include<iomanip> #include<numeric> using ll = long long; using namespace std; const ll M = 1000000007; int main(){ int n, sum = 0, ans; cin >> n; int a[2][101]; int mx = a[0][0]; for(int i = 0; i < 2; i++){ for(int j = 0; j < n; j++){ cin >> a[i][j]; } } for(int i = 0; i < n; i++){ sum += a[0][i]; } sum += a[1][n-1]; ans = sum; for(int i = n; i >= 1; i--){ sum -= a[0][i]; sum += a[1][i-1]; if(sum > ans) ans = sum; } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Candies |
User | Kant |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 722 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 1 ms | 256 KB |
02.txt | WA | 1 ms | 256 KB |
03.txt | WA | 1 ms | 256 KB |
04.txt | WA | 1 ms | 256 KB |
05.txt | WA | 1 ms | 256 KB |
06.txt | WA | 1 ms | 256 KB |
07.txt | WA | 1 ms | 256 KB |
08.txt | WA | 1 ms | 256 KB |
09.txt | WA | 1 ms | 256 KB |
10.txt | WA | 1 ms | 256 KB |
11.txt | WA | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
sample01.txt | WA | 1 ms | 256 KB |
sample02.txt | WA | 1 ms | 256 KB |
sample03.txt | AC | 1 ms | 256 KB |
sample04.txt | WA | 1 ms | 256 KB |