#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;
ll arr[n];
ll sum=0;
for(int i=0;i<n;i++){
cin>>arr[i];
sum+=arr[i];
}
ll mx=0;
for(int i=0;i<n;i++){
ll sum2=0;
ll mn=INF;
for(int j=i+1;j<i+n/2+1;j++){
sum2+=arr[j%n];
}
for(int j=i+1;j<i+n/2+1;j++){
//cout<<sum2<<"\n";
mn=min(mn,sum-sum2);
sum2-=arr[(j)%n];
sum2+=arr[(j+n/2)%n];
}
//cout<<"\n";
mx=max(mx,mn);
}
cout<<mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
172 ms |
340 KB |
Output is correct |
4 |
Execution timed out |
1082 ms |
852 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |