# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
137483 | silxikys | Hacker (BOI15_hac) | C++14 | 60 ms | 10360 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 5e5+5;
int n;
int v[2*maxn];
int pre[2*maxn];
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> v[i];
v[i+n] = v[i];
}
pre[0] = v[0];
for (int i = 1; i < 2*n; i++) {
pre[i] = pre[i-1] + v[i];
}
int total = pre[n-1];
if (n <= 5000) {
int res = 0;
for (int i = 0; i < n; i++) {
int maxSum = 0;
for (int j = i+n/2; j < i+n; j++) {
maxSum = max(maxSum,pre[j]-pre[j-n/2]);
}
res = max(res,total-maxSum);
# | 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... |