# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
723674 |
2023-04-14T07:26:55 Z |
rshohruh |
Hacker (BOI15_hac) |
C++14 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
int main(){
#ifdef __local__
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
vector<int> a(n+1), p(n+1);
for(int i = 1; i <= n; ++i){
cin >> a[i];
p[i] = p[i-1] + a[i];
}
int x = upper_bound(p.begin(), p.end(), p.back()/2) - p.begin();
cout << a[x] + min(p[n]-p[x], p[x-1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 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 |
1 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 |
1 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 |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |