Submission #7067651
Source Code Expand
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define all(a) a.begin(),a.end() #define F first #define S second #define pb push_back #define ll long long #define ld long double #define mkp make_pair #define sz(x) (int)x.size() #define pi pair<long long, long long> #define endl '\n' #define _ << ' ' #define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x))) #define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x)) using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset; //find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x const ll mod = (ll)1e9+7; const ll INF = (ll)3e9+1; int n; int ans=0, a[2][100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE //freopen("D.txt", "r", stdin); #endif cin >> n; 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++) { int cur = 0; for(int j=0; j<n; j++) { if(j<i) { cur += a[0][j]; } else if(j>i) { cur += a[1][j]; } else { cur += a[0][j] + a[1][j]; } } ans = max(ans, cur); } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | C - Candies |
User | animefan6588 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1592 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 |