// Proof by AC
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int &v : A) {
cin >> v;
}
for (int i = 0; i < N; i++) {
A.push_back(A[i]);
}
vector<int> pref(2 * N);
for (int i = 0; i < 2 * N - 1; i++) {
pref[i + 1] = pref[i] + A[i];
}
vector<int> S;
for (int i = (N + 1) / 2; i < N + (N + 1) / 2; i++) {
S.push_back(pref[i] - pref[i - (N + 1) / 2]);
}
sort(S.rbegin(), S.rend());
cout << S[(N - 1) / 2] << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
- |