#include "towers.h"
#include <vector>
using namespace std;
const int N = 100000, L = 17, N_ = 1 << L, N1 = 1 + N * (L + 1), INF = 0x3f3f3f3f; /* L = ceil(log2(N)) */
int abs_(int a) { return a > 0 ? a : -a; }
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
typedef vector<int> vi;
int dd[N], iq[N + 1], pq[N], cnt;
int lt(int i, int j) { return dd[i] < dd[j]; }
int p2(int p) {
return (p *= 2) > cnt ? 0 : (p < cnt && lt(iq[p + 1], iq[p]) ? p + 1 : p);
}
void pq_up(int i) {
int p, q, j;
for (p = pq[i]; (q = p / 2) && lt(i, j = iq[q]); p = q)
iq[pq[j] = p] = j;
iq[pq[i] = p] = i;
}
void pq_dn(int i) {
int p, q, j;
for (p = pq[i]; (q = p2(p)) && lt(j = iq[q], i); p = q)
iq[pq[j] = p] = j;
iq[pq[i] = p] = i;
}
void pq_add(int i) {
pq[i] = ++cnt, pq_up(i);
}
int pq_remove_first() {
int i = iq[1], j = iq[cnt--];
if (j != i)
pq[j] = 1, pq_dn(j);
pq[i] = 0;
return i;
}
void pq_remove(int i) {
int j = iq[cnt--];
if (j != i)
pq[j] = pq[i], pq_up(j), pq_dn(j);
pq[i] = 0;
}
int st[N_ * 2], n_;
int query(int l, int r) {
int x = INF;
for (l += n_, r += n_; l <= r; l >>= 1, r >>= 1) {
if ((l & 1) == 1)
x = min(x, st[l++]);
if ((r & 1) == 0)
x = min(x, st[r--]);
}
return x;
}
int kk[N1], ll[N1], rr[N1], mn[N1], mx[N1], _ = 1;
int update_(int t, int l, int r, int i) {
int t_ = _++;
ll[t_] = ll[t], rr[t_] = rr[t], kk[t_] = kk[t] + 1, mn[t_] = min(mn[t], i), mx[t_] = max(mx[t], i);
if (r - l > 1) {
int m = (l + r) / 2;
if (i < m)
ll[t_] = update_(ll[t], l, m, i);
else
rr[t_] = update_(rr[t], m, r, i);
}
return t_;
}
int mn_, mx_, k_;
void query_(int t, int l, int r, int ql, int qr) {
if (t == 0 || qr <= l || r <= ql)
return;
if (ql <= l && r <= qr) {
mn_ = min(mn_, mn[t]), mx_ = max(mx_, mx[t]), k_ += kk[t];
return;
}
int m = (l + r) / 2;
query_(ll[t], l, m, ql, qr), query_(rr[t], m, r, ql, qr);
}
int aa[N], ii[N], tt[N + 1], pp[N], qq[N], n, k;
void init(int n1, vi aa_) {
n = n1;
for (int i = 0; i < n; i++)
aa[i] = aa_[i];
k = 0;
ii[k++] = 0;
for (int i = 1; i < n; i++)
if (k % 2 != 0) {
if (aa[ii[k - 1]] > aa[i])
ii[k - 1] = i;
else
ii[k++] = i;
} else {
if (aa[ii[k - 1]] < aa[i])
ii[k - 1] = i;
else
ii[k++] = i;
}
if (k % 2 == 0)
k--;
for (int h = 0; h < k; h++)
pp[ii[h]] = h == 0 ? -1 : ii[h - 1], qq[ii[h]] = h + 1 == k ? n : ii[h + 1];
for (int h = 0; h + 1 < k; h++)
dd[ii[h]] = abs_(aa[ii[h + 1]] - aa[ii[h]]), pq_add(ii[h]);
mn[0] = INF, mx[0] = -1;
k = 0;
while (cnt) {
int i = pq_remove_first(), j = qq[i], tmp;
if (pp[i] == -1) {
pq_remove(j);
pp[qq[j]] = -1;
} else if (qq[j] == n) {
pq_remove(pp[i]);
qq[pp[i]] = n;
} else {
pq_remove(pp[i]), pq_remove(j);
qq[pp[i]] = qq[j], pp[qq[j]] = pp[i];
dd[pp[i]] = abs_(aa[qq[j]] - aa[pp[i]]), pq_add(pp[i]);
}
if (aa[i] < aa[j]) {
tmp = i, i = j, j = tmp;
dd[i] = dd[j];
}
ii[k++] = i;
}
for (int h = k - 1; h >= 0; h--)
tt[h] = update_(tt[h + 1], 0, n, ii[h]);
n_ = 1;
while (n_ < n)
n_ <<= 1;
for (int i = 0; i < n; i++)
st[n_ + i] = aa[i];
for (int i = n_ - 1; i > 0; i--)
st[i] = min(st[i << 1 | 0], st[i << 1 | 1]);
}
int max_towers(int l, int r, int d) {
int lower = -1, upper = k;
while (upper - lower > 1) {
int h = (lower + upper) / 2;
if (dd[ii[h]] < d)
lower = h;
else
upper = h;
}
mn_ = INF, mx_ = -1, k_ = 0;
query_(tt[upper], 0, n, l, r);
if (k_ == 0)
return 1;
else if (k_ == 1)
return aa[mn_] - query(l, mn_) >= d && aa[mx_] - query(mx_, r) >= d ? 2 : 1;
else
return k_ - (aa[mn_] - query(l, mn_) >= d ? 0 : 1) - (aa[mx_] - query(mx_, r) >= d ? 0 : 1) + 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
1564 KB |
Output is correct |
2 |
Correct |
841 ms |
2472 KB |
Output is correct |
3 |
Correct |
1129 ms |
2356 KB |
Output is correct |
4 |
Correct |
725 ms |
2348 KB |
Output is correct |
5 |
Correct |
845 ms |
2384 KB |
Output is correct |
6 |
Correct |
884 ms |
2328 KB |
Output is correct |
7 |
Correct |
990 ms |
2332 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
592 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
592 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
356 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
592 KB |
Output is correct |
16 |
Correct |
1 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
592 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
592 KB |
Output is correct |
21 |
Correct |
1 ms |
592 KB |
Output is correct |
22 |
Correct |
1 ms |
592 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
1 ms |
664 KB |
Output is correct |
29 |
Correct |
2 ms |
592 KB |
Output is correct |
30 |
Correct |
2 ms |
592 KB |
Output is correct |
31 |
Correct |
2 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
592 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
592 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
356 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
592 KB |
Output is correct |
16 |
Correct |
1 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
592 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
592 KB |
Output is correct |
21 |
Correct |
1 ms |
592 KB |
Output is correct |
22 |
Correct |
1 ms |
592 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
1 ms |
664 KB |
Output is correct |
29 |
Correct |
2 ms |
592 KB |
Output is correct |
30 |
Correct |
2 ms |
592 KB |
Output is correct |
31 |
Correct |
2 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
37 ms |
10136 KB |
Output is correct |
37 |
Correct |
52 ms |
16164 KB |
Output is correct |
38 |
Correct |
54 ms |
16104 KB |
Output is correct |
39 |
Correct |
66 ms |
22176 KB |
Output is correct |
40 |
Correct |
71 ms |
22192 KB |
Output is correct |
41 |
Correct |
70 ms |
22252 KB |
Output is correct |
42 |
Correct |
79 ms |
22260 KB |
Output is correct |
43 |
Correct |
21 ms |
2352 KB |
Output is correct |
44 |
Correct |
21 ms |
2332 KB |
Output is correct |
45 |
Correct |
14 ms |
2460 KB |
Output is correct |
46 |
Correct |
19 ms |
2460 KB |
Output is correct |
47 |
Correct |
63 ms |
16116 KB |
Output is correct |
48 |
Correct |
68 ms |
22160 KB |
Output is correct |
49 |
Correct |
73 ms |
22180 KB |
Output is correct |
50 |
Correct |
12 ms |
2376 KB |
Output is correct |
51 |
Correct |
12 ms |
2464 KB |
Output is correct |
52 |
Correct |
48 ms |
16060 KB |
Output is correct |
53 |
Correct |
63 ms |
22156 KB |
Output is correct |
54 |
Correct |
60 ms |
22196 KB |
Output is correct |
55 |
Correct |
15 ms |
2384 KB |
Output is correct |
56 |
Correct |
14 ms |
2512 KB |
Output is correct |
57 |
Correct |
49 ms |
15624 KB |
Output is correct |
58 |
Correct |
61 ms |
16180 KB |
Output is correct |
59 |
Correct |
59 ms |
16108 KB |
Output is correct |
60 |
Correct |
67 ms |
22196 KB |
Output is correct |
61 |
Correct |
72 ms |
22196 KB |
Output is correct |
62 |
Correct |
64 ms |
22260 KB |
Output is correct |
63 |
Correct |
72 ms |
22252 KB |
Output is correct |
64 |
Correct |
14 ms |
2412 KB |
Output is correct |
65 |
Correct |
14 ms |
2320 KB |
Output is correct |
66 |
Correct |
14 ms |
2484 KB |
Output is correct |
67 |
Correct |
20 ms |
2456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
814 ms |
15948 KB |
Output is correct |
2 |
Correct |
1184 ms |
16120 KB |
Output is correct |
3 |
Correct |
1154 ms |
16112 KB |
Output is correct |
4 |
Correct |
1254 ms |
22212 KB |
Output is correct |
5 |
Correct |
1279 ms |
22172 KB |
Output is correct |
6 |
Correct |
1355 ms |
22208 KB |
Output is correct |
7 |
Correct |
1308 ms |
22252 KB |
Output is correct |
8 |
Correct |
1010 ms |
2332 KB |
Output is correct |
9 |
Correct |
1016 ms |
2392 KB |
Output is correct |
10 |
Correct |
909 ms |
2492 KB |
Output is correct |
11 |
Correct |
1125 ms |
2464 KB |
Output is correct |
12 |
Correct |
829 ms |
2340 KB |
Output is correct |
13 |
Correct |
972 ms |
2340 KB |
Output is correct |
14 |
Correct |
0 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
58 ms |
16072 KB |
Output is correct |
18 |
Correct |
67 ms |
22256 KB |
Output is correct |
19 |
Correct |
82 ms |
22188 KB |
Output is correct |
20 |
Correct |
14 ms |
2360 KB |
Output is correct |
21 |
Correct |
14 ms |
2480 KB |
Output is correct |
22 |
Correct |
64 ms |
16148 KB |
Output is correct |
23 |
Correct |
84 ms |
22252 KB |
Output is correct |
24 |
Correct |
88 ms |
22212 KB |
Output is correct |
25 |
Correct |
14 ms |
2336 KB |
Output is correct |
26 |
Correct |
24 ms |
2376 KB |
Output is correct |
27 |
Correct |
1 ms |
592 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
2 ms |
640 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
2 ms |
640 KB |
Output is correct |
34 |
Correct |
2 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
365 ms |
3772 KB |
Output is correct |
2 |
Correct |
1343 ms |
16168 KB |
Output is correct |
3 |
Correct |
1461 ms |
16108 KB |
Output is correct |
4 |
Correct |
1352 ms |
22236 KB |
Output is correct |
5 |
Correct |
1357 ms |
22216 KB |
Output is correct |
6 |
Correct |
1183 ms |
22204 KB |
Output is correct |
7 |
Correct |
1078 ms |
22216 KB |
Output is correct |
8 |
Correct |
975 ms |
2356 KB |
Output is correct |
9 |
Correct |
860 ms |
2352 KB |
Output is correct |
10 |
Correct |
919 ms |
2468 KB |
Output is correct |
11 |
Correct |
875 ms |
2512 KB |
Output is correct |
12 |
Correct |
57 ms |
16224 KB |
Output is correct |
13 |
Correct |
78 ms |
22176 KB |
Output is correct |
14 |
Correct |
77 ms |
22200 KB |
Output is correct |
15 |
Correct |
22 ms |
2412 KB |
Output is correct |
16 |
Correct |
13 ms |
2460 KB |
Output is correct |
17 |
Correct |
56 ms |
15644 KB |
Output is correct |
18 |
Correct |
59 ms |
16172 KB |
Output is correct |
19 |
Correct |
59 ms |
16116 KB |
Output is correct |
20 |
Correct |
83 ms |
22204 KB |
Output is correct |
21 |
Correct |
65 ms |
22188 KB |
Output is correct |
22 |
Correct |
72 ms |
22300 KB |
Output is correct |
23 |
Correct |
68 ms |
22168 KB |
Output is correct |
24 |
Correct |
14 ms |
2384 KB |
Output is correct |
25 |
Correct |
14 ms |
2376 KB |
Output is correct |
26 |
Correct |
19 ms |
2468 KB |
Output is correct |
27 |
Correct |
18 ms |
2512 KB |
Output is correct |
28 |
Correct |
1 ms |
628 KB |
Output is correct |
29 |
Correct |
1 ms |
592 KB |
Output is correct |
30 |
Correct |
1 ms |
592 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
464 KB |
Output is correct |
34 |
Correct |
1 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
592 KB |
Output is correct |
36 |
Correct |
1 ms |
592 KB |
Output is correct |
37 |
Correct |
1 ms |
604 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
1 ms |
604 KB |
Output is correct |
40 |
Correct |
1 ms |
348 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
368 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
592 KB |
Output is correct |
5 |
Correct |
2 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
592 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
356 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
592 KB |
Output is correct |
16 |
Correct |
1 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
592 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
592 KB |
Output is correct |
21 |
Correct |
1 ms |
592 KB |
Output is correct |
22 |
Correct |
1 ms |
592 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
1 ms |
664 KB |
Output is correct |
29 |
Correct |
2 ms |
592 KB |
Output is correct |
30 |
Correct |
2 ms |
592 KB |
Output is correct |
31 |
Correct |
2 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
37 ms |
10136 KB |
Output is correct |
37 |
Correct |
52 ms |
16164 KB |
Output is correct |
38 |
Correct |
54 ms |
16104 KB |
Output is correct |
39 |
Correct |
66 ms |
22176 KB |
Output is correct |
40 |
Correct |
71 ms |
22192 KB |
Output is correct |
41 |
Correct |
70 ms |
22252 KB |
Output is correct |
42 |
Correct |
79 ms |
22260 KB |
Output is correct |
43 |
Correct |
21 ms |
2352 KB |
Output is correct |
44 |
Correct |
21 ms |
2332 KB |
Output is correct |
45 |
Correct |
14 ms |
2460 KB |
Output is correct |
46 |
Correct |
19 ms |
2460 KB |
Output is correct |
47 |
Correct |
63 ms |
16116 KB |
Output is correct |
48 |
Correct |
68 ms |
22160 KB |
Output is correct |
49 |
Correct |
73 ms |
22180 KB |
Output is correct |
50 |
Correct |
12 ms |
2376 KB |
Output is correct |
51 |
Correct |
12 ms |
2464 KB |
Output is correct |
52 |
Correct |
48 ms |
16060 KB |
Output is correct |
53 |
Correct |
63 ms |
22156 KB |
Output is correct |
54 |
Correct |
60 ms |
22196 KB |
Output is correct |
55 |
Correct |
15 ms |
2384 KB |
Output is correct |
56 |
Correct |
14 ms |
2512 KB |
Output is correct |
57 |
Correct |
49 ms |
15624 KB |
Output is correct |
58 |
Correct |
61 ms |
16180 KB |
Output is correct |
59 |
Correct |
59 ms |
16108 KB |
Output is correct |
60 |
Correct |
67 ms |
22196 KB |
Output is correct |
61 |
Correct |
72 ms |
22196 KB |
Output is correct |
62 |
Correct |
64 ms |
22260 KB |
Output is correct |
63 |
Correct |
72 ms |
22252 KB |
Output is correct |
64 |
Correct |
14 ms |
2412 KB |
Output is correct |
65 |
Correct |
14 ms |
2320 KB |
Output is correct |
66 |
Correct |
14 ms |
2484 KB |
Output is correct |
67 |
Correct |
20 ms |
2456 KB |
Output is correct |
68 |
Correct |
814 ms |
15948 KB |
Output is correct |
69 |
Correct |
1184 ms |
16120 KB |
Output is correct |
70 |
Correct |
1154 ms |
16112 KB |
Output is correct |
71 |
Correct |
1254 ms |
22212 KB |
Output is correct |
72 |
Correct |
1279 ms |
22172 KB |
Output is correct |
73 |
Correct |
1355 ms |
22208 KB |
Output is correct |
74 |
Correct |
1308 ms |
22252 KB |
Output is correct |
75 |
Correct |
1010 ms |
2332 KB |
Output is correct |
76 |
Correct |
1016 ms |
2392 KB |
Output is correct |
77 |
Correct |
909 ms |
2492 KB |
Output is correct |
78 |
Correct |
1125 ms |
2464 KB |
Output is correct |
79 |
Correct |
829 ms |
2340 KB |
Output is correct |
80 |
Correct |
972 ms |
2340 KB |
Output is correct |
81 |
Correct |
0 ms |
336 KB |
Output is correct |
82 |
Correct |
1 ms |
336 KB |
Output is correct |
83 |
Correct |
1 ms |
336 KB |
Output is correct |
84 |
Correct |
58 ms |
16072 KB |
Output is correct |
85 |
Correct |
67 ms |
22256 KB |
Output is correct |
86 |
Correct |
82 ms |
22188 KB |
Output is correct |
87 |
Correct |
14 ms |
2360 KB |
Output is correct |
88 |
Correct |
14 ms |
2480 KB |
Output is correct |
89 |
Correct |
64 ms |
16148 KB |
Output is correct |
90 |
Correct |
84 ms |
22252 KB |
Output is correct |
91 |
Correct |
88 ms |
22212 KB |
Output is correct |
92 |
Correct |
14 ms |
2336 KB |
Output is correct |
93 |
Correct |
24 ms |
2376 KB |
Output is correct |
94 |
Correct |
1 ms |
592 KB |
Output is correct |
95 |
Correct |
2 ms |
592 KB |
Output is correct |
96 |
Correct |
2 ms |
640 KB |
Output is correct |
97 |
Correct |
1 ms |
336 KB |
Output is correct |
98 |
Correct |
1 ms |
336 KB |
Output is correct |
99 |
Correct |
1 ms |
592 KB |
Output is correct |
100 |
Correct |
2 ms |
640 KB |
Output is correct |
101 |
Correct |
2 ms |
592 KB |
Output is correct |
102 |
Correct |
1 ms |
336 KB |
Output is correct |
103 |
Correct |
1 ms |
336 KB |
Output is correct |
104 |
Correct |
940 ms |
14420 KB |
Output is correct |
105 |
Correct |
949 ms |
16076 KB |
Output is correct |
106 |
Correct |
1247 ms |
16120 KB |
Output is correct |
107 |
Correct |
1041 ms |
22216 KB |
Output is correct |
108 |
Correct |
1094 ms |
22184 KB |
Output is correct |
109 |
Correct |
1115 ms |
22164 KB |
Output is correct |
110 |
Correct |
1378 ms |
22256 KB |
Output is correct |
111 |
Correct |
798 ms |
2332 KB |
Output is correct |
112 |
Correct |
810 ms |
2364 KB |
Output is correct |
113 |
Correct |
973 ms |
2476 KB |
Output is correct |
114 |
Correct |
1059 ms |
2492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
232 ms |
1564 KB |
Output is correct |
2 |
Correct |
841 ms |
2472 KB |
Output is correct |
3 |
Correct |
1129 ms |
2356 KB |
Output is correct |
4 |
Correct |
725 ms |
2348 KB |
Output is correct |
5 |
Correct |
845 ms |
2384 KB |
Output is correct |
6 |
Correct |
884 ms |
2328 KB |
Output is correct |
7 |
Correct |
990 ms |
2332 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
336 KB |
Output is correct |
11 |
Correct |
0 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
592 KB |
Output is correct |
13 |
Correct |
2 ms |
592 KB |
Output is correct |
14 |
Correct |
1 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
592 KB |
Output is correct |
16 |
Correct |
1 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
592 KB |
Output is correct |
18 |
Correct |
1 ms |
356 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
1 ms |
592 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
592 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
464 KB |
Output is correct |
36 |
Correct |
1 ms |
592 KB |
Output is correct |
37 |
Correct |
2 ms |
592 KB |
Output is correct |
38 |
Correct |
1 ms |
664 KB |
Output is correct |
39 |
Correct |
2 ms |
592 KB |
Output is correct |
40 |
Correct |
2 ms |
592 KB |
Output is correct |
41 |
Correct |
2 ms |
592 KB |
Output is correct |
42 |
Correct |
1 ms |
336 KB |
Output is correct |
43 |
Correct |
1 ms |
336 KB |
Output is correct |
44 |
Correct |
1 ms |
336 KB |
Output is correct |
45 |
Correct |
1 ms |
336 KB |
Output is correct |
46 |
Correct |
37 ms |
10136 KB |
Output is correct |
47 |
Correct |
52 ms |
16164 KB |
Output is correct |
48 |
Correct |
54 ms |
16104 KB |
Output is correct |
49 |
Correct |
66 ms |
22176 KB |
Output is correct |
50 |
Correct |
71 ms |
22192 KB |
Output is correct |
51 |
Correct |
70 ms |
22252 KB |
Output is correct |
52 |
Correct |
79 ms |
22260 KB |
Output is correct |
53 |
Correct |
21 ms |
2352 KB |
Output is correct |
54 |
Correct |
21 ms |
2332 KB |
Output is correct |
55 |
Correct |
14 ms |
2460 KB |
Output is correct |
56 |
Correct |
19 ms |
2460 KB |
Output is correct |
57 |
Correct |
63 ms |
16116 KB |
Output is correct |
58 |
Correct |
68 ms |
22160 KB |
Output is correct |
59 |
Correct |
73 ms |
22180 KB |
Output is correct |
60 |
Correct |
12 ms |
2376 KB |
Output is correct |
61 |
Correct |
12 ms |
2464 KB |
Output is correct |
62 |
Correct |
48 ms |
16060 KB |
Output is correct |
63 |
Correct |
63 ms |
22156 KB |
Output is correct |
64 |
Correct |
60 ms |
22196 KB |
Output is correct |
65 |
Correct |
15 ms |
2384 KB |
Output is correct |
66 |
Correct |
14 ms |
2512 KB |
Output is correct |
67 |
Correct |
49 ms |
15624 KB |
Output is correct |
68 |
Correct |
61 ms |
16180 KB |
Output is correct |
69 |
Correct |
59 ms |
16108 KB |
Output is correct |
70 |
Correct |
67 ms |
22196 KB |
Output is correct |
71 |
Correct |
72 ms |
22196 KB |
Output is correct |
72 |
Correct |
64 ms |
22260 KB |
Output is correct |
73 |
Correct |
72 ms |
22252 KB |
Output is correct |
74 |
Correct |
14 ms |
2412 KB |
Output is correct |
75 |
Correct |
14 ms |
2320 KB |
Output is correct |
76 |
Correct |
14 ms |
2484 KB |
Output is correct |
77 |
Correct |
20 ms |
2456 KB |
Output is correct |
78 |
Correct |
814 ms |
15948 KB |
Output is correct |
79 |
Correct |
1184 ms |
16120 KB |
Output is correct |
80 |
Correct |
1154 ms |
16112 KB |
Output is correct |
81 |
Correct |
1254 ms |
22212 KB |
Output is correct |
82 |
Correct |
1279 ms |
22172 KB |
Output is correct |
83 |
Correct |
1355 ms |
22208 KB |
Output is correct |
84 |
Correct |
1308 ms |
22252 KB |
Output is correct |
85 |
Correct |
1010 ms |
2332 KB |
Output is correct |
86 |
Correct |
1016 ms |
2392 KB |
Output is correct |
87 |
Correct |
909 ms |
2492 KB |
Output is correct |
88 |
Correct |
1125 ms |
2464 KB |
Output is correct |
89 |
Correct |
829 ms |
2340 KB |
Output is correct |
90 |
Correct |
972 ms |
2340 KB |
Output is correct |
91 |
Correct |
0 ms |
336 KB |
Output is correct |
92 |
Correct |
1 ms |
336 KB |
Output is correct |
93 |
Correct |
1 ms |
336 KB |
Output is correct |
94 |
Correct |
58 ms |
16072 KB |
Output is correct |
95 |
Correct |
67 ms |
22256 KB |
Output is correct |
96 |
Correct |
82 ms |
22188 KB |
Output is correct |
97 |
Correct |
14 ms |
2360 KB |
Output is correct |
98 |
Correct |
14 ms |
2480 KB |
Output is correct |
99 |
Correct |
64 ms |
16148 KB |
Output is correct |
100 |
Correct |
84 ms |
22252 KB |
Output is correct |
101 |
Correct |
88 ms |
22212 KB |
Output is correct |
102 |
Correct |
14 ms |
2336 KB |
Output is correct |
103 |
Correct |
24 ms |
2376 KB |
Output is correct |
104 |
Correct |
1 ms |
592 KB |
Output is correct |
105 |
Correct |
2 ms |
592 KB |
Output is correct |
106 |
Correct |
2 ms |
640 KB |
Output is correct |
107 |
Correct |
1 ms |
336 KB |
Output is correct |
108 |
Correct |
1 ms |
336 KB |
Output is correct |
109 |
Correct |
1 ms |
592 KB |
Output is correct |
110 |
Correct |
2 ms |
640 KB |
Output is correct |
111 |
Correct |
2 ms |
592 KB |
Output is correct |
112 |
Correct |
1 ms |
336 KB |
Output is correct |
113 |
Correct |
1 ms |
336 KB |
Output is correct |
114 |
Correct |
365 ms |
3772 KB |
Output is correct |
115 |
Correct |
1343 ms |
16168 KB |
Output is correct |
116 |
Correct |
1461 ms |
16108 KB |
Output is correct |
117 |
Correct |
1352 ms |
22236 KB |
Output is correct |
118 |
Correct |
1357 ms |
22216 KB |
Output is correct |
119 |
Correct |
1183 ms |
22204 KB |
Output is correct |
120 |
Correct |
1078 ms |
22216 KB |
Output is correct |
121 |
Correct |
975 ms |
2356 KB |
Output is correct |
122 |
Correct |
860 ms |
2352 KB |
Output is correct |
123 |
Correct |
919 ms |
2468 KB |
Output is correct |
124 |
Correct |
875 ms |
2512 KB |
Output is correct |
125 |
Correct |
57 ms |
16224 KB |
Output is correct |
126 |
Correct |
78 ms |
22176 KB |
Output is correct |
127 |
Correct |
77 ms |
22200 KB |
Output is correct |
128 |
Correct |
22 ms |
2412 KB |
Output is correct |
129 |
Correct |
13 ms |
2460 KB |
Output is correct |
130 |
Correct |
56 ms |
15644 KB |
Output is correct |
131 |
Correct |
59 ms |
16172 KB |
Output is correct |
132 |
Correct |
59 ms |
16116 KB |
Output is correct |
133 |
Correct |
83 ms |
22204 KB |
Output is correct |
134 |
Correct |
65 ms |
22188 KB |
Output is correct |
135 |
Correct |
72 ms |
22300 KB |
Output is correct |
136 |
Correct |
68 ms |
22168 KB |
Output is correct |
137 |
Correct |
14 ms |
2384 KB |
Output is correct |
138 |
Correct |
14 ms |
2376 KB |
Output is correct |
139 |
Correct |
19 ms |
2468 KB |
Output is correct |
140 |
Correct |
18 ms |
2512 KB |
Output is correct |
141 |
Correct |
1 ms |
628 KB |
Output is correct |
142 |
Correct |
1 ms |
592 KB |
Output is correct |
143 |
Correct |
1 ms |
592 KB |
Output is correct |
144 |
Correct |
1 ms |
336 KB |
Output is correct |
145 |
Correct |
1 ms |
336 KB |
Output is correct |
146 |
Correct |
1 ms |
464 KB |
Output is correct |
147 |
Correct |
1 ms |
592 KB |
Output is correct |
148 |
Correct |
1 ms |
592 KB |
Output is correct |
149 |
Correct |
1 ms |
592 KB |
Output is correct |
150 |
Correct |
1 ms |
604 KB |
Output is correct |
151 |
Correct |
1 ms |
604 KB |
Output is correct |
152 |
Correct |
1 ms |
604 KB |
Output is correct |
153 |
Correct |
1 ms |
348 KB |
Output is correct |
154 |
Correct |
1 ms |
348 KB |
Output is correct |
155 |
Correct |
1 ms |
368 KB |
Output is correct |
156 |
Correct |
1 ms |
348 KB |
Output is correct |
157 |
Correct |
940 ms |
14420 KB |
Output is correct |
158 |
Correct |
949 ms |
16076 KB |
Output is correct |
159 |
Correct |
1247 ms |
16120 KB |
Output is correct |
160 |
Correct |
1041 ms |
22216 KB |
Output is correct |
161 |
Correct |
1094 ms |
22184 KB |
Output is correct |
162 |
Correct |
1115 ms |
22164 KB |
Output is correct |
163 |
Correct |
1378 ms |
22256 KB |
Output is correct |
164 |
Correct |
798 ms |
2332 KB |
Output is correct |
165 |
Correct |
810 ms |
2364 KB |
Output is correct |
166 |
Correct |
973 ms |
2476 KB |
Output is correct |
167 |
Correct |
1059 ms |
2492 KB |
Output is correct |
168 |
Correct |
1 ms |
336 KB |
Output is correct |
169 |
Correct |
782 ms |
5472 KB |
Output is correct |
170 |
Correct |
1520 ms |
15996 KB |
Output is correct |
171 |
Correct |
1632 ms |
16036 KB |
Output is correct |
172 |
Correct |
1606 ms |
22184 KB |
Output is correct |
173 |
Correct |
1607 ms |
22172 KB |
Output is correct |
174 |
Correct |
1428 ms |
22188 KB |
Output is correct |
175 |
Correct |
1292 ms |
22244 KB |
Output is correct |
176 |
Correct |
656 ms |
2460 KB |
Output is correct |
177 |
Correct |
851 ms |
2332 KB |
Output is correct |
178 |
Correct |
838 ms |
2376 KB |
Output is correct |
179 |
Correct |
932 ms |
2384 KB |
Output is correct |