# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
729554 |
2023-04-24T09:05:12 Z |
Tigerpants |
Hacker (BOI15_hac) |
C++17 |
|
423 ms |
25368 KB |
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef map<ll, ll> mll_ll;
#define rep(i, a, b) for (ll i = a; i < b; i++)
ll N;
vll v;
vll dv;
ll get_slice(ll f, ll s) {
return dv[s + 1] - dv[f] + ((f > s) ? dv[N] : 0);
}
ll half_N;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
half_N = (N + 1) / 2;
v.resize(N);
dv.resize(N + 1);
dv[0] = 0;
rep(i, 0, N) {
cin >> v[i];
dv[i + 1] = dv[i] + v[i];
}
ll best = 0;
mll_ll slices;
rep(i, 0, half_N) {
slices[get_slice(i, (i + half_N - 1) % N)]++;
}
rep(i, 0, N) {
best = max<ll>(best, slices.begin()->first);
slices[get_slice(i, (i + half_N - 1) % N)]--;
if (slices[get_slice(i, (i + half_N - 1) % N)] == 0) slices.erase(get_slice(i, (i + half_N - 1) % N));
slices[get_slice((i + half_N) % N, ((2 * half_N) + i - 1) % N)]++;
}
cout << best << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
316 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
252 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
316 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
252 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
468 KB |
Output is correct |
23 |
Correct |
3 ms |
468 KB |
Output is correct |
24 |
Correct |
3 ms |
324 KB |
Output is correct |
25 |
Correct |
3 ms |
576 KB |
Output is correct |
26 |
Correct |
3 ms |
468 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
3 ms |
468 KB |
Output is correct |
31 |
Correct |
2 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
552 KB |
Output is correct |
4 |
Correct |
45 ms |
4180 KB |
Output is correct |
5 |
Correct |
116 ms |
8160 KB |
Output is correct |
6 |
Correct |
176 ms |
11596 KB |
Output is correct |
7 |
Correct |
192 ms |
14088 KB |
Output is correct |
8 |
Correct |
423 ms |
21512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
316 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
252 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
468 KB |
Output is correct |
23 |
Correct |
3 ms |
468 KB |
Output is correct |
24 |
Correct |
3 ms |
324 KB |
Output is correct |
25 |
Correct |
3 ms |
576 KB |
Output is correct |
26 |
Correct |
3 ms |
468 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
3 ms |
468 KB |
Output is correct |
31 |
Correct |
2 ms |
468 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
3 ms |
552 KB |
Output is correct |
35 |
Correct |
45 ms |
4180 KB |
Output is correct |
36 |
Correct |
116 ms |
8160 KB |
Output is correct |
37 |
Correct |
176 ms |
11596 KB |
Output is correct |
38 |
Correct |
192 ms |
14088 KB |
Output is correct |
39 |
Correct |
423 ms |
21512 KB |
Output is correct |
40 |
Correct |
6 ms |
824 KB |
Output is correct |
41 |
Correct |
14 ms |
1236 KB |
Output is correct |
42 |
Correct |
22 ms |
1804 KB |
Output is correct |
43 |
Correct |
183 ms |
9488 KB |
Output is correct |
44 |
Correct |
396 ms |
22900 KB |
Output is correct |
45 |
Correct |
44 ms |
3668 KB |
Output is correct |
46 |
Correct |
184 ms |
14460 KB |
Output is correct |
47 |
Correct |
371 ms |
22036 KB |
Output is correct |
48 |
Correct |
64 ms |
10560 KB |
Output is correct |
49 |
Correct |
251 ms |
25368 KB |
Output is correct |
50 |
Correct |
254 ms |
25360 KB |
Output is correct |