# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
340191 |
2020-12-27T09:17:34 Z |
blue |
Hacker (BOI15_hac) |
C++11 |
|
546 ms |
18476 KB |
#include <iostream>
#include <set>
using namespace std;
/*
For any starting position, the operator can force the hacker into any contiguous ceil(n/2) positions
containing that particular position.
*/
int main()
{
int n;
cin >> n;
int v[n];
int i, j;
for(i = 0; i < n; i++) cin >> v[i];
int a_size = n - (n/2);
int w[n];
w[0] = 0;
for(j = 0; j < a_size; j++) w[0] += v[j];
j--;
for(i = 1; i < n; i++)
{
w[i] = w[i-1] + v[(i + a_size - 1) % n] - v[i-1];
}
multiset<int> S;
for(j = 0; j < a_size; j++) S.insert(w[j]);
j--;
int res = *S.begin();
for(i = 1; i < n; i++)
{
S.insert(w[(i + a_size - 1) % n]);
S.erase(S.find(w[i-1]));
res = max(res, *S.begin());
}
cout << res << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
2 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
364 KB |
Output is correct |
22 |
Correct |
3 ms |
364 KB |
Output is correct |
23 |
Correct |
4 ms |
492 KB |
Output is correct |
24 |
Correct |
3 ms |
364 KB |
Output is correct |
25 |
Correct |
4 ms |
492 KB |
Output is correct |
26 |
Correct |
4 ms |
492 KB |
Output is correct |
27 |
Correct |
1 ms |
364 KB |
Output is correct |
28 |
Correct |
1 ms |
364 KB |
Output is correct |
29 |
Correct |
1 ms |
364 KB |
Output is correct |
30 |
Correct |
4 ms |
492 KB |
Output is correct |
31 |
Correct |
4 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
4 ms |
492 KB |
Output is correct |
4 |
Correct |
53 ms |
3180 KB |
Output is correct |
5 |
Correct |
172 ms |
7400 KB |
Output is correct |
6 |
Correct |
215 ms |
9196 KB |
Output is correct |
7 |
Correct |
249 ms |
11244 KB |
Output is correct |
8 |
Correct |
546 ms |
18156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
2 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
364 KB |
Output is correct |
22 |
Correct |
3 ms |
364 KB |
Output is correct |
23 |
Correct |
4 ms |
492 KB |
Output is correct |
24 |
Correct |
3 ms |
364 KB |
Output is correct |
25 |
Correct |
4 ms |
492 KB |
Output is correct |
26 |
Correct |
4 ms |
492 KB |
Output is correct |
27 |
Correct |
1 ms |
364 KB |
Output is correct |
28 |
Correct |
1 ms |
364 KB |
Output is correct |
29 |
Correct |
1 ms |
364 KB |
Output is correct |
30 |
Correct |
4 ms |
492 KB |
Output is correct |
31 |
Correct |
4 ms |
492 KB |
Output is correct |
32 |
Correct |
1 ms |
364 KB |
Output is correct |
33 |
Correct |
1 ms |
364 KB |
Output is correct |
34 |
Correct |
4 ms |
492 KB |
Output is correct |
35 |
Correct |
53 ms |
3180 KB |
Output is correct |
36 |
Correct |
172 ms |
7400 KB |
Output is correct |
37 |
Correct |
215 ms |
9196 KB |
Output is correct |
38 |
Correct |
249 ms |
11244 KB |
Output is correct |
39 |
Correct |
546 ms |
18156 KB |
Output is correct |
40 |
Correct |
6 ms |
640 KB |
Output is correct |
41 |
Correct |
13 ms |
1004 KB |
Output is correct |
42 |
Correct |
19 ms |
1388 KB |
Output is correct |
43 |
Correct |
184 ms |
7512 KB |
Output is correct |
44 |
Correct |
468 ms |
18148 KB |
Output is correct |
45 |
Correct |
271 ms |
3820 KB |
Output is correct |
46 |
Correct |
241 ms |
10988 KB |
Output is correct |
47 |
Correct |
539 ms |
18384 KB |
Output is correct |
48 |
Correct |
361 ms |
18476 KB |
Output is correct |
49 |
Correct |
283 ms |
17608 KB |
Output is correct |
50 |
Correct |
280 ms |
17516 KB |
Output is correct |