#include "bits/stdc++.h"
using namespace std;
#define INF 2000000000
#define INFLL 3000000000000000000LL
#define ll long long
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin>>n;
int arr[n];
int sum=0;
int sum2=0;
for(int i=0;i<n;i++){
cin>>arr[i];
sum+=arr[i];
if(i<(n+1)/2)sum2+=arr[i];
}
set<pair<int,int>>s;
for(int i=0;i<n;i++){
if(sum2>sum-sum2){
s.insert({sum-sum2,sum2});
sum2-=arr[i];
sum2+=arr[(i+(n+1)/2+1)%n];
}
}
cout<<(*s.begin()).second;
}
# |
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 |
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 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
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 |
- |