#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 5e5 + 9;
int a[MAXN], dp[MAXN];
bool used[MAXN];
signed main(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
dp[i + 1] = dp[i] + a[i];
}
priority_queue<int> pq;
for(int i = 0; i < n; i++){
pq.push(dp[min(i + n / 2 + n % 2, n)] - dp[i] + dp[max(i + n / 2 + n % 2 - n, 0ll)]);
}
pq.pop();
cout << pq.top();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |