이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define N 200050
using namespace std;
int n, v[N], sum[N], k, ans[N][2], resp;
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
cin>>n;
k = (n + 1)/2;
for(int i = 1; i <= n; i++)
{
cin>>v[i];
v[i + n] = v[i];
}
for(int i = 1; i <= 2*n; i++) sum[i] = sum[i - 1] + v[i];
for(int i = 1; i <= n; i++) ans[i][0] = sum[i + k - 1] - sum[i - 1];
for(int i = n + 1; i <= 2*n; i++) ans[i - n][1] = sum[i] - sum[i - k];
for(int i = 1; i <= n; i++) resp = max(resp, min(ans[i][0], ans[i][1]));
cout<<resp<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |