# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
995223 |
2024-06-08T16:44:52 Z |
BF001 |
Hacker (BOI15_hac) |
C++17 |
|
284 ms |
26364 KB |
#include <bits/stdc++.h>
using namespace std;
#define N 500005
#define int long long
int n, a[2 * N], res[N];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> n;
for (int i = 1; i <= n; i++){
cin >> a[i];
res[i] = 1e18;
a[i + n] = a[i];
a[i] += a[i - 1];
}
for (int i = n + 1; i <= 2 * n; i++){
a[i] += a[i - 1];
}
int sz = (n + 1) / 2;
multiset<int> st;
for (int i = 1; i <= 2 * n; i++){
if (i + sz - 1 <= 2 * n){
st.insert(a[i + sz - 1] - a[i - 1]);
}
if (i > sz){
st.erase(st.find(a[i - 1] - a[i - 1 - sz]));
}
int pos = ((i - 1) % n) + 1;
res[pos] = min(res[pos], *st.begin());
}
int ans = 0;
for (auto i = 1; i <= n; i++) ans = max(ans, res[i]);
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2648 KB |
Output is correct |
13 |
Correct |
0 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
2512 KB |
Output is correct |
16 |
Correct |
0 ms |
2512 KB |
Output is correct |
17 |
Correct |
0 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2648 KB |
Output is correct |
13 |
Correct |
0 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
2512 KB |
Output is correct |
16 |
Correct |
0 ms |
2512 KB |
Output is correct |
17 |
Correct |
0 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2532 KB |
Output is correct |
23 |
Correct |
2 ms |
2652 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
2 ms |
2652 KB |
Output is correct |
26 |
Correct |
2 ms |
2692 KB |
Output is correct |
27 |
Correct |
1 ms |
2396 KB |
Output is correct |
28 |
Correct |
0 ms |
2396 KB |
Output is correct |
29 |
Correct |
1 ms |
2396 KB |
Output is correct |
30 |
Correct |
2 ms |
2652 KB |
Output is correct |
31 |
Correct |
2 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2652 KB |
Output is correct |
4 |
Correct |
27 ms |
9048 KB |
Output is correct |
5 |
Correct |
85 ms |
14172 KB |
Output is correct |
6 |
Correct |
138 ms |
15700 KB |
Output is correct |
7 |
Correct |
122 ms |
19284 KB |
Output is correct |
8 |
Correct |
284 ms |
25940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2648 KB |
Output is correct |
13 |
Correct |
0 ms |
2396 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
0 ms |
2512 KB |
Output is correct |
16 |
Correct |
0 ms |
2512 KB |
Output is correct |
17 |
Correct |
0 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2532 KB |
Output is correct |
23 |
Correct |
2 ms |
2652 KB |
Output is correct |
24 |
Correct |
1 ms |
2396 KB |
Output is correct |
25 |
Correct |
2 ms |
2652 KB |
Output is correct |
26 |
Correct |
2 ms |
2692 KB |
Output is correct |
27 |
Correct |
1 ms |
2396 KB |
Output is correct |
28 |
Correct |
0 ms |
2396 KB |
Output is correct |
29 |
Correct |
1 ms |
2396 KB |
Output is correct |
30 |
Correct |
2 ms |
2652 KB |
Output is correct |
31 |
Correct |
2 ms |
2652 KB |
Output is correct |
32 |
Correct |
0 ms |
2396 KB |
Output is correct |
33 |
Correct |
0 ms |
2396 KB |
Output is correct |
34 |
Correct |
2 ms |
2652 KB |
Output is correct |
35 |
Correct |
27 ms |
9048 KB |
Output is correct |
36 |
Correct |
85 ms |
14172 KB |
Output is correct |
37 |
Correct |
138 ms |
15700 KB |
Output is correct |
38 |
Correct |
122 ms |
19284 KB |
Output is correct |
39 |
Correct |
284 ms |
25940 KB |
Output is correct |
40 |
Correct |
4 ms |
2652 KB |
Output is correct |
41 |
Correct |
7 ms |
3164 KB |
Output is correct |
42 |
Correct |
12 ms |
7384 KB |
Output is correct |
43 |
Correct |
86 ms |
14324 KB |
Output is correct |
44 |
Correct |
237 ms |
25940 KB |
Output is correct |
45 |
Correct |
35 ms |
9308 KB |
Output is correct |
46 |
Correct |
130 ms |
19224 KB |
Output is correct |
47 |
Correct |
231 ms |
25940 KB |
Output is correct |
48 |
Correct |
184 ms |
26364 KB |
Output is correct |
49 |
Correct |
161 ms |
25428 KB |
Output is correct |
50 |
Correct |
158 ms |
25428 KB |
Output is correct |