# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49121 |
2018-05-22T13:12:18 Z |
faishol27 |
Hacker (BOI15_hac) |
C++14 |
|
3 ms |
452 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXE = 1e9+5;
int N, dapat;
ll data[500005],
total = 0,
ans = MAXE,
sliding = 0,
setengah;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> N;
dapat = (N+1)/2;
for(int i=0;i<N;i++){
cin >> data[i];
total += data[i];
}
setengah = total/2;
for(int i=0;i<dapat;i++) sliding += data[i];
if(sliding > setengah){
ans = min(sliding, ans);
}
//cout << sliding << endl;
for(int i=1;i<N;i++){
int right = (dapat+i-1)%N;
sliding = sliding-data[i-1]+data[right];
if(sliding > setengah){
ans = min(sliding, ans);
}
// cout << sliding << endl;
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
452 KB |
Output is correct |
2 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |