# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
723816 |
2023-04-14T10:43:40 Z |
OttincaM |
Hacker (BOI15_hac) |
C++17 |
|
1 ms |
212 KB |
#include <iostream>
#include <vector>
#include "stdio.h"
#pragma GCC optimize("Ofast,O3,unroll-loops")
using namespace std;
signed main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef WTF
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
int n; cin >> n;
vector <int> a(n + 1);
for(int i = 1; i <= n; i ++){
cin >> a[i];
}
vector <int> pr(n + 1, 0), sf(n + 2, 0);
for(int i = 1; i <= n; i ++){
pr[i] = pr[i - 1] + a[i];
}
for(int i = n; i >= 1; i --){
sf[i] = sf[i + 1] + a[i];
}
int ans = 0;
for(int i = 1; i <= n; i ++){
ans = max(ans, min(pr[i], sf[i]));
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |