// correct/solution-amnu-ac.cpp
#include "towers.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
const int MAXN = 1e5+5;
const int INF = 2e9;
struct gap {
int L, R, mi, ma, val;
gap operator + (gap o) {
gap ret;
ret.L = L;
ret.R = o.R;
ret.mi = min(mi,o.mi);
ret.ma = max(ma,o.ma);
ret.val = max(o.ma-mi,max(val,o.val));
return ret;
}
};
struct tree {
int L, R;
gap val;
tree *lef, *rig;
void build(int l,int r,vector<int> &v) {
L = l; R = r;
if (L == R) {
val.L = L;
val.R = R;
val.mi = v[L];
val.ma = v[R];
val.val = 0;
return;
}
int mid = (L+R)/2;
lef = new tree();
rig = new tree();
lef->build(L,mid,v);
rig->build(mid+1,R,v);
val = lef->val + rig->val;
}
gap query(int D,gap x) {
if (R <= x.R || L > x.R+1) return x;
if (L == x.R+1 && (x+val).val < D) return x+val;
if (L == R) return x;
return rig->query(D,lef->query(D,x));
}
}
pref, suff;
struct answer {
int L, R, val;
answer *lef, *rig;
void build(int l,int r) {
L = l; R = r;
val = 0;
if (L < R) {
int mid = (L + R)/2;
lef = new answer();
rig = new answer();
lef->build(L,mid);
rig->build(mid+1,R);
}
}
answer *toggle(int id) {
answer *ret = new answer();
*ret = *this;
if (L == R) {
ret->val = 1 - ret->val;
return ret;
}
int mid = (L + R)/2;
if (id <= mid) ret->lef = lef->toggle(id);
else ret->rig = rig->toggle(id);
ret->val = ret->lef->val + ret->rig->val;
return ret;
}
int query(int l,int r) {
if (l > R || r < L) return 0;
if (l <= L && r >= R) return val;
return lef->query(l,r) + rig->query(l,r);
}
};
int N;
vector <int> delta;
vector <answer*> cand;
set <piii> zigzag;
set <pii> shortest;
void init(int n,vector<int> H) {
N = n;
pref.build(0,N-1,H);
reverse(H.begin(),H.end());
suff.build(0,N-1,H);
H.push_back(INF);
reverse(H.begin(),H.end());
H.push_back(INF);
H.push_back(0);
piii now = {0,{INF,0}};
for (int i = 1; i <= N+1; i++) {
if (H[i] < H[i-1] && H[i] < H[i+1]) {
now.fi = i-1;
now.se.fi -= H[i];
now.se.se = -H[i];
}
if (H[i] > H[i-1] && H[i] > H[i+1]) {
now.se.se += H[i];
zigzag.insert(now);
now.se.fi = H[i];
}
}
cand.push_back(new answer());
cand[0]->build(0,N-1);
for (piii zig : zigzag) {
cand[0] = cand[0]->toggle(zig.fi);
shortest.insert({zig.se.fi,-zig.fi});
shortest.insert({zig.se.se,zig.fi});
}
while (zigzag.size() > 1) {
pii pos = *shortest.begin();
auto it = zigzag.lower_bound({abs(pos.se),{0,0}});
piii zig = *it;
delta.push_back(pos.fi);
cand.push_back(cand.back()->toggle(abs(pos.se)));
if (pos.se < 0) {
piii zag = *--it;
zigzag.erase(zag);
shortest.erase({zag.se.se,zag.fi});
zag.se.se += zig.se.se - zig.se.fi;
zigzag.insert(zag);
shortest.insert({zag.se.se,zag.fi});
}
else {
piii zag = *++it;
zigzag.erase(zag);
shortest.erase({zag.se.fi,-zag.fi});
zag.se.fi += zig.se.fi - zig.se.se;
zigzag.insert(zag);
shortest.insert({zag.se.fi,-zag.fi});
}
shortest.erase({zig.se.fi,-zig.fi});
shortest.erase({zig.se.se,zig.fi});
zigzag.erase(zig);
}
}
int max_towers(int L,int R,int D) {
L = pref.query(D,{0,L-1,INF,0,0}).R + 1;
R = N - suff.query(D,{0,N-R-2,INF,0,0}).R - 2;
if (L > R) return 1;
D = lower_bound(delta.begin(),delta.end(),D) - delta.begin();
return 2 + cand[D]->query(L,R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
596 ms |
21300 KB |
Output is correct |
2 |
Correct |
1342 ms |
35392 KB |
Output is correct |
3 |
Correct |
1071 ms |
35480 KB |
Output is correct |
4 |
Correct |
1438 ms |
35464 KB |
Output is correct |
5 |
Correct |
1261 ms |
35416 KB |
Output is correct |
6 |
Correct |
908 ms |
35400 KB |
Output is correct |
7 |
Correct |
1338 ms |
35492 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
1744 KB |
Output is correct |
3 |
Correct |
5 ms |
1744 KB |
Output is correct |
4 |
Correct |
4 ms |
2156 KB |
Output is correct |
5 |
Correct |
6 ms |
2176 KB |
Output is correct |
6 |
Correct |
5 ms |
2128 KB |
Output is correct |
7 |
Correct |
6 ms |
2172 KB |
Output is correct |
8 |
Correct |
2 ms |
976 KB |
Output is correct |
9 |
Correct |
2 ms |
976 KB |
Output is correct |
10 |
Correct |
2 ms |
976 KB |
Output is correct |
11 |
Correct |
2 ms |
976 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
976 KB |
Output is correct |
15 |
Correct |
3 ms |
1772 KB |
Output is correct |
16 |
Correct |
4 ms |
2176 KB |
Output is correct |
17 |
Correct |
4 ms |
2060 KB |
Output is correct |
18 |
Correct |
1 ms |
1004 KB |
Output is correct |
19 |
Correct |
2 ms |
1024 KB |
Output is correct |
20 |
Correct |
4 ms |
1744 KB |
Output is correct |
21 |
Correct |
5 ms |
2044 KB |
Output is correct |
22 |
Correct |
6 ms |
2056 KB |
Output is correct |
23 |
Correct |
1 ms |
1024 KB |
Output is correct |
24 |
Correct |
1 ms |
976 KB |
Output is correct |
25 |
Correct |
2 ms |
848 KB |
Output is correct |
26 |
Correct |
3 ms |
1744 KB |
Output is correct |
27 |
Correct |
4 ms |
1688 KB |
Output is correct |
28 |
Correct |
6 ms |
2172 KB |
Output is correct |
29 |
Correct |
6 ms |
2128 KB |
Output is correct |
30 |
Correct |
6 ms |
2084 KB |
Output is correct |
31 |
Correct |
4 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1024 KB |
Output is correct |
33 |
Correct |
2 ms |
1012 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
2 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
1744 KB |
Output is correct |
3 |
Correct |
5 ms |
1744 KB |
Output is correct |
4 |
Correct |
4 ms |
2156 KB |
Output is correct |
5 |
Correct |
6 ms |
2176 KB |
Output is correct |
6 |
Correct |
5 ms |
2128 KB |
Output is correct |
7 |
Correct |
6 ms |
2172 KB |
Output is correct |
8 |
Correct |
2 ms |
976 KB |
Output is correct |
9 |
Correct |
2 ms |
976 KB |
Output is correct |
10 |
Correct |
2 ms |
976 KB |
Output is correct |
11 |
Correct |
2 ms |
976 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
976 KB |
Output is correct |
15 |
Correct |
3 ms |
1772 KB |
Output is correct |
16 |
Correct |
4 ms |
2176 KB |
Output is correct |
17 |
Correct |
4 ms |
2060 KB |
Output is correct |
18 |
Correct |
1 ms |
1004 KB |
Output is correct |
19 |
Correct |
2 ms |
1024 KB |
Output is correct |
20 |
Correct |
4 ms |
1744 KB |
Output is correct |
21 |
Correct |
5 ms |
2044 KB |
Output is correct |
22 |
Correct |
6 ms |
2056 KB |
Output is correct |
23 |
Correct |
1 ms |
1024 KB |
Output is correct |
24 |
Correct |
1 ms |
976 KB |
Output is correct |
25 |
Correct |
2 ms |
848 KB |
Output is correct |
26 |
Correct |
3 ms |
1744 KB |
Output is correct |
27 |
Correct |
4 ms |
1688 KB |
Output is correct |
28 |
Correct |
6 ms |
2172 KB |
Output is correct |
29 |
Correct |
6 ms |
2128 KB |
Output is correct |
30 |
Correct |
6 ms |
2084 KB |
Output is correct |
31 |
Correct |
4 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1024 KB |
Output is correct |
33 |
Correct |
2 ms |
1012 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
2 ms |
1024 KB |
Output is correct |
36 |
Correct |
163 ms |
58328 KB |
Output is correct |
37 |
Correct |
299 ms |
92056 KB |
Output is correct |
38 |
Correct |
262 ms |
91740 KB |
Output is correct |
39 |
Correct |
529 ms |
119944 KB |
Output is correct |
40 |
Correct |
503 ms |
119960 KB |
Output is correct |
41 |
Correct |
486 ms |
119916 KB |
Output is correct |
42 |
Correct |
421 ms |
119940 KB |
Output is correct |
43 |
Correct |
62 ms |
35452 KB |
Output is correct |
44 |
Correct |
52 ms |
35424 KB |
Output is correct |
45 |
Correct |
68 ms |
35468 KB |
Output is correct |
46 |
Correct |
56 ms |
35448 KB |
Output is correct |
47 |
Correct |
321 ms |
91812 KB |
Output is correct |
48 |
Correct |
553 ms |
119956 KB |
Output is correct |
49 |
Correct |
495 ms |
119952 KB |
Output is correct |
50 |
Correct |
55 ms |
35436 KB |
Output is correct |
51 |
Correct |
60 ms |
35416 KB |
Output is correct |
52 |
Correct |
284 ms |
91836 KB |
Output is correct |
53 |
Correct |
444 ms |
120000 KB |
Output is correct |
54 |
Correct |
571 ms |
119944 KB |
Output is correct |
55 |
Correct |
67 ms |
35428 KB |
Output is correct |
56 |
Correct |
60 ms |
35484 KB |
Output is correct |
57 |
Correct |
338 ms |
88596 KB |
Output is correct |
58 |
Correct |
370 ms |
91916 KB |
Output is correct |
59 |
Correct |
341 ms |
92076 KB |
Output is correct |
60 |
Correct |
511 ms |
120036 KB |
Output is correct |
61 |
Correct |
445 ms |
119996 KB |
Output is correct |
62 |
Correct |
499 ms |
120048 KB |
Output is correct |
63 |
Correct |
486 ms |
119932 KB |
Output is correct |
64 |
Correct |
53 ms |
35484 KB |
Output is correct |
65 |
Correct |
53 ms |
35480 KB |
Output is correct |
66 |
Correct |
60 ms |
35504 KB |
Output is correct |
67 |
Correct |
44 ms |
35460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1432 ms |
91036 KB |
Output is correct |
2 |
Correct |
1793 ms |
91840 KB |
Output is correct |
3 |
Correct |
1963 ms |
91880 KB |
Output is correct |
4 |
Correct |
1905 ms |
120028 KB |
Output is correct |
5 |
Correct |
2009 ms |
119920 KB |
Output is correct |
6 |
Correct |
1872 ms |
119972 KB |
Output is correct |
7 |
Correct |
1942 ms |
119964 KB |
Output is correct |
8 |
Correct |
1116 ms |
35392 KB |
Output is correct |
9 |
Correct |
1124 ms |
35388 KB |
Output is correct |
10 |
Correct |
1348 ms |
35528 KB |
Output is correct |
11 |
Correct |
1324 ms |
35464 KB |
Output is correct |
12 |
Correct |
1158 ms |
35508 KB |
Output is correct |
13 |
Correct |
1161 ms |
35508 KB |
Output is correct |
14 |
Correct |
1 ms |
240 KB |
Output is correct |
15 |
Correct |
2 ms |
1012 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
367 ms |
91744 KB |
Output is correct |
18 |
Correct |
486 ms |
119964 KB |
Output is correct |
19 |
Correct |
489 ms |
120024 KB |
Output is correct |
20 |
Correct |
59 ms |
35472 KB |
Output is correct |
21 |
Correct |
45 ms |
35428 KB |
Output is correct |
22 |
Correct |
329 ms |
91776 KB |
Output is correct |
23 |
Correct |
487 ms |
119916 KB |
Output is correct |
24 |
Correct |
479 ms |
119972 KB |
Output is correct |
25 |
Correct |
68 ms |
35420 KB |
Output is correct |
26 |
Correct |
63 ms |
35480 KB |
Output is correct |
27 |
Correct |
4 ms |
1744 KB |
Output is correct |
28 |
Correct |
5 ms |
2176 KB |
Output is correct |
29 |
Correct |
6 ms |
2128 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
2 ms |
976 KB |
Output is correct |
32 |
Correct |
3 ms |
1748 KB |
Output is correct |
33 |
Correct |
5 ms |
2128 KB |
Output is correct |
34 |
Correct |
5 ms |
2128 KB |
Output is correct |
35 |
Correct |
1 ms |
976 KB |
Output is correct |
36 |
Correct |
1 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
507 ms |
20576 KB |
Output is correct |
2 |
Correct |
1704 ms |
91872 KB |
Output is correct |
3 |
Correct |
1516 ms |
91836 KB |
Output is correct |
4 |
Correct |
2247 ms |
120028 KB |
Output is correct |
5 |
Correct |
1775 ms |
119912 KB |
Output is correct |
6 |
Correct |
1678 ms |
120016 KB |
Output is correct |
7 |
Correct |
1807 ms |
119920 KB |
Output is correct |
8 |
Correct |
1118 ms |
35440 KB |
Output is correct |
9 |
Correct |
1024 ms |
35412 KB |
Output is correct |
10 |
Correct |
1206 ms |
35392 KB |
Output is correct |
11 |
Correct |
1272 ms |
35472 KB |
Output is correct |
12 |
Correct |
285 ms |
91880 KB |
Output is correct |
13 |
Correct |
436 ms |
119932 KB |
Output is correct |
14 |
Correct |
530 ms |
119980 KB |
Output is correct |
15 |
Correct |
63 ms |
35440 KB |
Output is correct |
16 |
Correct |
63 ms |
35488 KB |
Output is correct |
17 |
Correct |
279 ms |
88612 KB |
Output is correct |
18 |
Correct |
267 ms |
91980 KB |
Output is correct |
19 |
Correct |
280 ms |
92016 KB |
Output is correct |
20 |
Correct |
446 ms |
119928 KB |
Output is correct |
21 |
Correct |
493 ms |
119912 KB |
Output is correct |
22 |
Correct |
519 ms |
119936 KB |
Output is correct |
23 |
Correct |
436 ms |
120020 KB |
Output is correct |
24 |
Correct |
47 ms |
35484 KB |
Output is correct |
25 |
Correct |
61 ms |
35472 KB |
Output is correct |
26 |
Correct |
40 ms |
35392 KB |
Output is correct |
27 |
Correct |
47 ms |
35508 KB |
Output is correct |
28 |
Correct |
4 ms |
1744 KB |
Output is correct |
29 |
Correct |
6 ms |
2128 KB |
Output is correct |
30 |
Correct |
5 ms |
2128 KB |
Output is correct |
31 |
Correct |
1 ms |
976 KB |
Output is correct |
32 |
Correct |
1 ms |
976 KB |
Output is correct |
33 |
Correct |
2 ms |
848 KB |
Output is correct |
34 |
Correct |
3 ms |
1744 KB |
Output is correct |
35 |
Correct |
4 ms |
1744 KB |
Output is correct |
36 |
Correct |
4 ms |
2128 KB |
Output is correct |
37 |
Correct |
5 ms |
2128 KB |
Output is correct |
38 |
Correct |
6 ms |
2128 KB |
Output is correct |
39 |
Correct |
6 ms |
2128 KB |
Output is correct |
40 |
Correct |
1 ms |
976 KB |
Output is correct |
41 |
Correct |
2 ms |
976 KB |
Output is correct |
42 |
Correct |
1 ms |
976 KB |
Output is correct |
43 |
Correct |
1 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
1744 KB |
Output is correct |
3 |
Correct |
5 ms |
1744 KB |
Output is correct |
4 |
Correct |
4 ms |
2156 KB |
Output is correct |
5 |
Correct |
6 ms |
2176 KB |
Output is correct |
6 |
Correct |
5 ms |
2128 KB |
Output is correct |
7 |
Correct |
6 ms |
2172 KB |
Output is correct |
8 |
Correct |
2 ms |
976 KB |
Output is correct |
9 |
Correct |
2 ms |
976 KB |
Output is correct |
10 |
Correct |
2 ms |
976 KB |
Output is correct |
11 |
Correct |
2 ms |
976 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
976 KB |
Output is correct |
15 |
Correct |
3 ms |
1772 KB |
Output is correct |
16 |
Correct |
4 ms |
2176 KB |
Output is correct |
17 |
Correct |
4 ms |
2060 KB |
Output is correct |
18 |
Correct |
1 ms |
1004 KB |
Output is correct |
19 |
Correct |
2 ms |
1024 KB |
Output is correct |
20 |
Correct |
4 ms |
1744 KB |
Output is correct |
21 |
Correct |
5 ms |
2044 KB |
Output is correct |
22 |
Correct |
6 ms |
2056 KB |
Output is correct |
23 |
Correct |
1 ms |
1024 KB |
Output is correct |
24 |
Correct |
1 ms |
976 KB |
Output is correct |
25 |
Correct |
2 ms |
848 KB |
Output is correct |
26 |
Correct |
3 ms |
1744 KB |
Output is correct |
27 |
Correct |
4 ms |
1688 KB |
Output is correct |
28 |
Correct |
6 ms |
2172 KB |
Output is correct |
29 |
Correct |
6 ms |
2128 KB |
Output is correct |
30 |
Correct |
6 ms |
2084 KB |
Output is correct |
31 |
Correct |
4 ms |
2128 KB |
Output is correct |
32 |
Correct |
1 ms |
1024 KB |
Output is correct |
33 |
Correct |
2 ms |
1012 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
2 ms |
1024 KB |
Output is correct |
36 |
Correct |
163 ms |
58328 KB |
Output is correct |
37 |
Correct |
299 ms |
92056 KB |
Output is correct |
38 |
Correct |
262 ms |
91740 KB |
Output is correct |
39 |
Correct |
529 ms |
119944 KB |
Output is correct |
40 |
Correct |
503 ms |
119960 KB |
Output is correct |
41 |
Correct |
486 ms |
119916 KB |
Output is correct |
42 |
Correct |
421 ms |
119940 KB |
Output is correct |
43 |
Correct |
62 ms |
35452 KB |
Output is correct |
44 |
Correct |
52 ms |
35424 KB |
Output is correct |
45 |
Correct |
68 ms |
35468 KB |
Output is correct |
46 |
Correct |
56 ms |
35448 KB |
Output is correct |
47 |
Correct |
321 ms |
91812 KB |
Output is correct |
48 |
Correct |
553 ms |
119956 KB |
Output is correct |
49 |
Correct |
495 ms |
119952 KB |
Output is correct |
50 |
Correct |
55 ms |
35436 KB |
Output is correct |
51 |
Correct |
60 ms |
35416 KB |
Output is correct |
52 |
Correct |
284 ms |
91836 KB |
Output is correct |
53 |
Correct |
444 ms |
120000 KB |
Output is correct |
54 |
Correct |
571 ms |
119944 KB |
Output is correct |
55 |
Correct |
67 ms |
35428 KB |
Output is correct |
56 |
Correct |
60 ms |
35484 KB |
Output is correct |
57 |
Correct |
338 ms |
88596 KB |
Output is correct |
58 |
Correct |
370 ms |
91916 KB |
Output is correct |
59 |
Correct |
341 ms |
92076 KB |
Output is correct |
60 |
Correct |
511 ms |
120036 KB |
Output is correct |
61 |
Correct |
445 ms |
119996 KB |
Output is correct |
62 |
Correct |
499 ms |
120048 KB |
Output is correct |
63 |
Correct |
486 ms |
119932 KB |
Output is correct |
64 |
Correct |
53 ms |
35484 KB |
Output is correct |
65 |
Correct |
53 ms |
35480 KB |
Output is correct |
66 |
Correct |
60 ms |
35504 KB |
Output is correct |
67 |
Correct |
44 ms |
35460 KB |
Output is correct |
68 |
Correct |
1432 ms |
91036 KB |
Output is correct |
69 |
Correct |
1793 ms |
91840 KB |
Output is correct |
70 |
Correct |
1963 ms |
91880 KB |
Output is correct |
71 |
Correct |
1905 ms |
120028 KB |
Output is correct |
72 |
Correct |
2009 ms |
119920 KB |
Output is correct |
73 |
Correct |
1872 ms |
119972 KB |
Output is correct |
74 |
Correct |
1942 ms |
119964 KB |
Output is correct |
75 |
Correct |
1116 ms |
35392 KB |
Output is correct |
76 |
Correct |
1124 ms |
35388 KB |
Output is correct |
77 |
Correct |
1348 ms |
35528 KB |
Output is correct |
78 |
Correct |
1324 ms |
35464 KB |
Output is correct |
79 |
Correct |
1158 ms |
35508 KB |
Output is correct |
80 |
Correct |
1161 ms |
35508 KB |
Output is correct |
81 |
Correct |
1 ms |
240 KB |
Output is correct |
82 |
Correct |
2 ms |
1012 KB |
Output is correct |
83 |
Correct |
2 ms |
976 KB |
Output is correct |
84 |
Correct |
367 ms |
91744 KB |
Output is correct |
85 |
Correct |
486 ms |
119964 KB |
Output is correct |
86 |
Correct |
489 ms |
120024 KB |
Output is correct |
87 |
Correct |
59 ms |
35472 KB |
Output is correct |
88 |
Correct |
45 ms |
35428 KB |
Output is correct |
89 |
Correct |
329 ms |
91776 KB |
Output is correct |
90 |
Correct |
487 ms |
119916 KB |
Output is correct |
91 |
Correct |
479 ms |
119972 KB |
Output is correct |
92 |
Correct |
68 ms |
35420 KB |
Output is correct |
93 |
Correct |
63 ms |
35480 KB |
Output is correct |
94 |
Correct |
4 ms |
1744 KB |
Output is correct |
95 |
Correct |
5 ms |
2176 KB |
Output is correct |
96 |
Correct |
6 ms |
2128 KB |
Output is correct |
97 |
Correct |
1 ms |
976 KB |
Output is correct |
98 |
Correct |
2 ms |
976 KB |
Output is correct |
99 |
Correct |
3 ms |
1748 KB |
Output is correct |
100 |
Correct |
5 ms |
2128 KB |
Output is correct |
101 |
Correct |
5 ms |
2128 KB |
Output is correct |
102 |
Correct |
1 ms |
976 KB |
Output is correct |
103 |
Correct |
1 ms |
976 KB |
Output is correct |
104 |
Correct |
1533 ms |
81236 KB |
Output is correct |
105 |
Correct |
1865 ms |
91656 KB |
Output is correct |
106 |
Correct |
2181 ms |
92056 KB |
Output is correct |
107 |
Correct |
2066 ms |
120016 KB |
Output is correct |
108 |
Correct |
2035 ms |
120036 KB |
Output is correct |
109 |
Correct |
2096 ms |
119968 KB |
Output is correct |
110 |
Correct |
2178 ms |
119992 KB |
Output is correct |
111 |
Correct |
1404 ms |
35420 KB |
Output is correct |
112 |
Correct |
1304 ms |
35512 KB |
Output is correct |
113 |
Correct |
1339 ms |
35484 KB |
Output is correct |
114 |
Correct |
1622 ms |
35468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
596 ms |
21300 KB |
Output is correct |
2 |
Correct |
1342 ms |
35392 KB |
Output is correct |
3 |
Correct |
1071 ms |
35480 KB |
Output is correct |
4 |
Correct |
1438 ms |
35464 KB |
Output is correct |
5 |
Correct |
1261 ms |
35416 KB |
Output is correct |
6 |
Correct |
908 ms |
35400 KB |
Output is correct |
7 |
Correct |
1338 ms |
35492 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
976 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
1744 KB |
Output is correct |
13 |
Correct |
5 ms |
1744 KB |
Output is correct |
14 |
Correct |
4 ms |
2156 KB |
Output is correct |
15 |
Correct |
6 ms |
2176 KB |
Output is correct |
16 |
Correct |
5 ms |
2128 KB |
Output is correct |
17 |
Correct |
6 ms |
2172 KB |
Output is correct |
18 |
Correct |
2 ms |
976 KB |
Output is correct |
19 |
Correct |
2 ms |
976 KB |
Output is correct |
20 |
Correct |
2 ms |
976 KB |
Output is correct |
21 |
Correct |
2 ms |
976 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
2 ms |
976 KB |
Output is correct |
24 |
Correct |
1 ms |
976 KB |
Output is correct |
25 |
Correct |
3 ms |
1772 KB |
Output is correct |
26 |
Correct |
4 ms |
2176 KB |
Output is correct |
27 |
Correct |
4 ms |
2060 KB |
Output is correct |
28 |
Correct |
1 ms |
1004 KB |
Output is correct |
29 |
Correct |
2 ms |
1024 KB |
Output is correct |
30 |
Correct |
4 ms |
1744 KB |
Output is correct |
31 |
Correct |
5 ms |
2044 KB |
Output is correct |
32 |
Correct |
6 ms |
2056 KB |
Output is correct |
33 |
Correct |
1 ms |
1024 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
2 ms |
848 KB |
Output is correct |
36 |
Correct |
3 ms |
1744 KB |
Output is correct |
37 |
Correct |
4 ms |
1688 KB |
Output is correct |
38 |
Correct |
6 ms |
2172 KB |
Output is correct |
39 |
Correct |
6 ms |
2128 KB |
Output is correct |
40 |
Correct |
6 ms |
2084 KB |
Output is correct |
41 |
Correct |
4 ms |
2128 KB |
Output is correct |
42 |
Correct |
1 ms |
1024 KB |
Output is correct |
43 |
Correct |
2 ms |
1012 KB |
Output is correct |
44 |
Correct |
1 ms |
976 KB |
Output is correct |
45 |
Correct |
2 ms |
1024 KB |
Output is correct |
46 |
Correct |
163 ms |
58328 KB |
Output is correct |
47 |
Correct |
299 ms |
92056 KB |
Output is correct |
48 |
Correct |
262 ms |
91740 KB |
Output is correct |
49 |
Correct |
529 ms |
119944 KB |
Output is correct |
50 |
Correct |
503 ms |
119960 KB |
Output is correct |
51 |
Correct |
486 ms |
119916 KB |
Output is correct |
52 |
Correct |
421 ms |
119940 KB |
Output is correct |
53 |
Correct |
62 ms |
35452 KB |
Output is correct |
54 |
Correct |
52 ms |
35424 KB |
Output is correct |
55 |
Correct |
68 ms |
35468 KB |
Output is correct |
56 |
Correct |
56 ms |
35448 KB |
Output is correct |
57 |
Correct |
321 ms |
91812 KB |
Output is correct |
58 |
Correct |
553 ms |
119956 KB |
Output is correct |
59 |
Correct |
495 ms |
119952 KB |
Output is correct |
60 |
Correct |
55 ms |
35436 KB |
Output is correct |
61 |
Correct |
60 ms |
35416 KB |
Output is correct |
62 |
Correct |
284 ms |
91836 KB |
Output is correct |
63 |
Correct |
444 ms |
120000 KB |
Output is correct |
64 |
Correct |
571 ms |
119944 KB |
Output is correct |
65 |
Correct |
67 ms |
35428 KB |
Output is correct |
66 |
Correct |
60 ms |
35484 KB |
Output is correct |
67 |
Correct |
338 ms |
88596 KB |
Output is correct |
68 |
Correct |
370 ms |
91916 KB |
Output is correct |
69 |
Correct |
341 ms |
92076 KB |
Output is correct |
70 |
Correct |
511 ms |
120036 KB |
Output is correct |
71 |
Correct |
445 ms |
119996 KB |
Output is correct |
72 |
Correct |
499 ms |
120048 KB |
Output is correct |
73 |
Correct |
486 ms |
119932 KB |
Output is correct |
74 |
Correct |
53 ms |
35484 KB |
Output is correct |
75 |
Correct |
53 ms |
35480 KB |
Output is correct |
76 |
Correct |
60 ms |
35504 KB |
Output is correct |
77 |
Correct |
44 ms |
35460 KB |
Output is correct |
78 |
Correct |
1432 ms |
91036 KB |
Output is correct |
79 |
Correct |
1793 ms |
91840 KB |
Output is correct |
80 |
Correct |
1963 ms |
91880 KB |
Output is correct |
81 |
Correct |
1905 ms |
120028 KB |
Output is correct |
82 |
Correct |
2009 ms |
119920 KB |
Output is correct |
83 |
Correct |
1872 ms |
119972 KB |
Output is correct |
84 |
Correct |
1942 ms |
119964 KB |
Output is correct |
85 |
Correct |
1116 ms |
35392 KB |
Output is correct |
86 |
Correct |
1124 ms |
35388 KB |
Output is correct |
87 |
Correct |
1348 ms |
35528 KB |
Output is correct |
88 |
Correct |
1324 ms |
35464 KB |
Output is correct |
89 |
Correct |
1158 ms |
35508 KB |
Output is correct |
90 |
Correct |
1161 ms |
35508 KB |
Output is correct |
91 |
Correct |
1 ms |
240 KB |
Output is correct |
92 |
Correct |
2 ms |
1012 KB |
Output is correct |
93 |
Correct |
2 ms |
976 KB |
Output is correct |
94 |
Correct |
367 ms |
91744 KB |
Output is correct |
95 |
Correct |
486 ms |
119964 KB |
Output is correct |
96 |
Correct |
489 ms |
120024 KB |
Output is correct |
97 |
Correct |
59 ms |
35472 KB |
Output is correct |
98 |
Correct |
45 ms |
35428 KB |
Output is correct |
99 |
Correct |
329 ms |
91776 KB |
Output is correct |
100 |
Correct |
487 ms |
119916 KB |
Output is correct |
101 |
Correct |
479 ms |
119972 KB |
Output is correct |
102 |
Correct |
68 ms |
35420 KB |
Output is correct |
103 |
Correct |
63 ms |
35480 KB |
Output is correct |
104 |
Correct |
4 ms |
1744 KB |
Output is correct |
105 |
Correct |
5 ms |
2176 KB |
Output is correct |
106 |
Correct |
6 ms |
2128 KB |
Output is correct |
107 |
Correct |
1 ms |
976 KB |
Output is correct |
108 |
Correct |
2 ms |
976 KB |
Output is correct |
109 |
Correct |
3 ms |
1748 KB |
Output is correct |
110 |
Correct |
5 ms |
2128 KB |
Output is correct |
111 |
Correct |
5 ms |
2128 KB |
Output is correct |
112 |
Correct |
1 ms |
976 KB |
Output is correct |
113 |
Correct |
1 ms |
976 KB |
Output is correct |
114 |
Correct |
507 ms |
20576 KB |
Output is correct |
115 |
Correct |
1704 ms |
91872 KB |
Output is correct |
116 |
Correct |
1516 ms |
91836 KB |
Output is correct |
117 |
Correct |
2247 ms |
120028 KB |
Output is correct |
118 |
Correct |
1775 ms |
119912 KB |
Output is correct |
119 |
Correct |
1678 ms |
120016 KB |
Output is correct |
120 |
Correct |
1807 ms |
119920 KB |
Output is correct |
121 |
Correct |
1118 ms |
35440 KB |
Output is correct |
122 |
Correct |
1024 ms |
35412 KB |
Output is correct |
123 |
Correct |
1206 ms |
35392 KB |
Output is correct |
124 |
Correct |
1272 ms |
35472 KB |
Output is correct |
125 |
Correct |
285 ms |
91880 KB |
Output is correct |
126 |
Correct |
436 ms |
119932 KB |
Output is correct |
127 |
Correct |
530 ms |
119980 KB |
Output is correct |
128 |
Correct |
63 ms |
35440 KB |
Output is correct |
129 |
Correct |
63 ms |
35488 KB |
Output is correct |
130 |
Correct |
279 ms |
88612 KB |
Output is correct |
131 |
Correct |
267 ms |
91980 KB |
Output is correct |
132 |
Correct |
280 ms |
92016 KB |
Output is correct |
133 |
Correct |
446 ms |
119928 KB |
Output is correct |
134 |
Correct |
493 ms |
119912 KB |
Output is correct |
135 |
Correct |
519 ms |
119936 KB |
Output is correct |
136 |
Correct |
436 ms |
120020 KB |
Output is correct |
137 |
Correct |
47 ms |
35484 KB |
Output is correct |
138 |
Correct |
61 ms |
35472 KB |
Output is correct |
139 |
Correct |
40 ms |
35392 KB |
Output is correct |
140 |
Correct |
47 ms |
35508 KB |
Output is correct |
141 |
Correct |
4 ms |
1744 KB |
Output is correct |
142 |
Correct |
6 ms |
2128 KB |
Output is correct |
143 |
Correct |
5 ms |
2128 KB |
Output is correct |
144 |
Correct |
1 ms |
976 KB |
Output is correct |
145 |
Correct |
1 ms |
976 KB |
Output is correct |
146 |
Correct |
2 ms |
848 KB |
Output is correct |
147 |
Correct |
3 ms |
1744 KB |
Output is correct |
148 |
Correct |
4 ms |
1744 KB |
Output is correct |
149 |
Correct |
4 ms |
2128 KB |
Output is correct |
150 |
Correct |
5 ms |
2128 KB |
Output is correct |
151 |
Correct |
6 ms |
2128 KB |
Output is correct |
152 |
Correct |
6 ms |
2128 KB |
Output is correct |
153 |
Correct |
1 ms |
976 KB |
Output is correct |
154 |
Correct |
2 ms |
976 KB |
Output is correct |
155 |
Correct |
1 ms |
976 KB |
Output is correct |
156 |
Correct |
1 ms |
976 KB |
Output is correct |
157 |
Correct |
1533 ms |
81236 KB |
Output is correct |
158 |
Correct |
1865 ms |
91656 KB |
Output is correct |
159 |
Correct |
2181 ms |
92056 KB |
Output is correct |
160 |
Correct |
2066 ms |
120016 KB |
Output is correct |
161 |
Correct |
2035 ms |
120036 KB |
Output is correct |
162 |
Correct |
2096 ms |
119968 KB |
Output is correct |
163 |
Correct |
2178 ms |
119992 KB |
Output is correct |
164 |
Correct |
1404 ms |
35420 KB |
Output is correct |
165 |
Correct |
1304 ms |
35512 KB |
Output is correct |
166 |
Correct |
1339 ms |
35484 KB |
Output is correct |
167 |
Correct |
1622 ms |
35468 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Correct |
1162 ms |
30292 KB |
Output is correct |
170 |
Correct |
1943 ms |
91492 KB |
Output is correct |
171 |
Correct |
2057 ms |
91752 KB |
Output is correct |
172 |
Correct |
2342 ms |
119956 KB |
Output is correct |
173 |
Correct |
2232 ms |
119960 KB |
Output is correct |
174 |
Correct |
2258 ms |
119932 KB |
Output is correct |
175 |
Correct |
2247 ms |
119936 KB |
Output is correct |
176 |
Correct |
1429 ms |
35508 KB |
Output is correct |
177 |
Correct |
1634 ms |
35448 KB |
Output is correct |
178 |
Correct |
1553 ms |
35484 KB |
Output is correct |
179 |
Correct |
1363 ms |
35440 KB |
Output is correct |