Submission #114592

# Submission time Handle Problem Language Result Execution time Memory
114592 2019-06-02T02:34:02 Z oolimry Hacker (BOI15_hac) C++14
100 / 100
600 ms 18424 KB
#include <bits/stdc++.h>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	
 	int n;
 	ios_base::sync_with_stdio(false);
 	
 	cin >> n;
 	int arr[n];
 	
 	int k = (n+1) / 2;
 	int s = 0;
 	for(int i =0;i < n;i++){
 		cin >> arr[i];
 		if(i<k) s += arr[i];
 	}
 	
 	int pre[n];
 	pre[0] = s;
 	for(int i = 0;i < n - 1;i++){
 		s += arr[(i+k)%n];
 		s -= arr[i];
 		pre[i+1] = s;
 	}
 	
 	multiset<int> x;
 	for(int i= 0; i < k; i++){
 		x.insert(pre[i]);
 	}
 	
 	int ans = *x.begin();
 	
 	for(int i = 0;i < n - 1;i++){
 		x.insert(pre[(i+k)%n]);
 		x.erase(x.find(pre[i]));
 		ans = max(ans,*x.begin());
 		
 	}
 	
 	cout << ans;
 	

 	return 0;
 }
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 0 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 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 1 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 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 0 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 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 1 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 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 4 ms 512 KB Output is correct
24 Correct 3 ms 380 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 4 ms 512 KB Output is correct
4 Correct 45 ms 3192 KB Output is correct
5 Correct 146 ms 7416 KB Output is correct
6 Correct 212 ms 9408 KB Output is correct
7 Correct 226 ms 11256 KB Output is correct
8 Correct 600 ms 18300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 0 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 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 1 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 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 4 ms 512 KB Output is correct
24 Correct 3 ms 380 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 4 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 4 ms 512 KB Output is correct
35 Correct 45 ms 3192 KB Output is correct
36 Correct 146 ms 7416 KB Output is correct
37 Correct 212 ms 9408 KB Output is correct
38 Correct 226 ms 11256 KB Output is correct
39 Correct 600 ms 18300 KB Output is correct
40 Correct 6 ms 640 KB Output is correct
41 Correct 12 ms 1152 KB Output is correct
42 Correct 15 ms 1408 KB Output is correct
43 Correct 164 ms 7544 KB Output is correct
44 Correct 514 ms 18288 KB Output is correct
45 Correct 61 ms 3840 KB Output is correct
46 Correct 248 ms 10980 KB Output is correct
47 Correct 590 ms 18412 KB Output is correct
48 Correct 285 ms 18424 KB Output is correct
49 Correct 259 ms 17656 KB Output is correct
50 Correct 261 ms 17656 KB Output is correct