Submission #867436

# Submission time Handle Problem Language Result Execution time Memory
867436 2023-10-28T11:47:50 Z dio_2 Hacker (BOI15_hac) C++17
40 / 100
1000 ms 2476 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int N;
	cin >> N;
	
	vector<int> A(N);
	for(int &x : A) cin >> x; // A[i] <= 2000

	for(int i = 0;i < N;i++) A.push_back(A[i]);
	for(int i = 0;i < N;i++) A.push_back(A[i]);
	
	vector<int> ps(3 * N);
	for(int i = 0;i < 3 * N;i++){
		ps[i] = A[i];
		if(i) ps[i] += ps[i-1];
	}
	
	auto Sum = [&](int l, int r)->int{
		int res = ps[r];
		if(l) res -= ps[l - 1];
		return res;	
	};
	
	int ans = 0;
	int K = (N + 1) / 2;
	
	for(int i = N;i < 2 * N;i++){
		int res = 2000 * N;
		for(int start = i - K + 1;start <= i;++start){
			res = min(res, Sum(start, start + K - 1));
		}
		ans = max(ans, res);
	}
	
	cout << ans << '\n';
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 5 ms 548 KB Output is correct
23 Correct 12 ms 348 KB Output is correct
24 Correct 5 ms 348 KB Output is correct
25 Correct 12 ms 600 KB Output is correct
26 Correct 12 ms 604 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 448 KB Output is correct
30 Correct 12 ms 592 KB Output is correct
31 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 12 ms 608 KB Output is correct
4 Execution timed out 1054 ms 2476 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 5 ms 548 KB Output is correct
23 Correct 12 ms 348 KB Output is correct
24 Correct 5 ms 348 KB Output is correct
25 Correct 12 ms 600 KB Output is correct
26 Correct 12 ms 604 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 448 KB Output is correct
30 Correct 12 ms 592 KB Output is correct
31 Correct 12 ms 344 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 12 ms 608 KB Output is correct
35 Execution timed out 1054 ms 2476 KB Time limit exceeded
36 Halted 0 ms 0 KB -