답안 #101129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101129 2019-03-16T18:39:38 Z luciocf Hacker (BOI15_hac) C++14
60 / 100
133 ms 6392 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 5e5+10;

int n;
int v[maxn], soma[maxn];

int solve(void)
{
	int ans = 0, sz = (n+1)/2;

	for (int i = 0; i < n; i++)
	{
		int aux = 1e9+10;

		for (int qtd = 1, r = i; qtd <= sz; qtd++, r = (r+1)%n)
		{
			int resto = sz-qtd;
			int l = (i-resto+n)%n;

			int s1, s2;

			if (r >= 0 && r < i) s2 = (soma[n-1]-soma[i])+soma[r];
			else s2 = soma[r]-soma[i];

			if (l < n && l > i) s1 = soma[i]+(soma[n-1]-soma[l-1]);
			else s1 = (l ? soma[i]-soma[l-1] : soma[i]);

			aux = min(aux, s1+s2);
		}

		ans = max(ans, aux);

		if (n > 5000) return ans;
	}

	return ans;
}

int main(void)
{
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> v[i];

		if (i > 0) soma[i] = soma[i-1] + v[i];
		else soma[i] = v[i];
	}

	cout << solve() << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 46 ms 384 KB Output is correct
23 Correct 128 ms 400 KB Output is correct
24 Correct 46 ms 504 KB Output is correct
25 Correct 124 ms 416 KB Output is correct
26 Correct 126 ms 460 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 129 ms 400 KB Output is correct
31 Correct 131 ms 404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 133 ms 400 KB Output is correct
4 Correct 23 ms 1152 KB Output is correct
5 Correct 64 ms 2696 KB Output is correct
6 Correct 72 ms 3448 KB Output is correct
7 Correct 80 ms 4060 KB Output is correct
8 Correct 126 ms 6392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 46 ms 384 KB Output is correct
23 Correct 128 ms 400 KB Output is correct
24 Correct 46 ms 504 KB Output is correct
25 Correct 124 ms 416 KB Output is correct
26 Correct 126 ms 460 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 129 ms 400 KB Output is correct
31 Correct 131 ms 404 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 3 ms 256 KB Output is correct
34 Correct 133 ms 400 KB Output is correct
35 Correct 23 ms 1152 KB Output is correct
36 Correct 64 ms 2696 KB Output is correct
37 Correct 72 ms 3448 KB Output is correct
38 Correct 80 ms 4060 KB Output is correct
39 Correct 126 ms 6392 KB Output is correct
40 Incorrect 7 ms 640 KB Output isn't correct
41 Halted 0 ms 0 KB -