#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "lib/debug.h"
#else
#include "towers.h"
#define debug(...) 0
#endif
typedef vector<int> vi;
const int N = 1e5, INF = 1e9 + 1;
template<typename Tp, int N>
struct Rmq_mn {
static const int L = __lg(N - 1) + 1;
Tp ar[1 << L], t[L][1 << L];
Tp op(Tp l, Tp r) {
return min(l, r);
}
void bld(int n, Tp *ar_) {
int h = n == 1 ? 0 : __lg(n - 1) + 1;
for (int i = 0; i < 1 << h; i++)
ar[i] = i < n ? ar_[i] : Tp();
bld(0, (1 << h) - 1, h - 1);
}
void bld(int l, int r, int h) {
if (h >= 0) {
int m = (l + r) / 2;
for (int i = m; i >= l; i--)
t[h][i] = i == m ? ar[i] : op(ar[i], t[h][i + 1]);
for (int i = m + 1; i <= r; i++)
t[h][i] = i == m + 1 ? ar[i] : op(t[h][i - 1], ar[i]);
bld(l, m, h - 1), bld(m + 1, r, h - 1);
}
}
Tp qry(int l, int r) {
if (l > r)
return INT_MAX;
if (l == r)
return ar[l];
int h = __lg(l ^ r);
return op(t[h][l], t[h][r]);
}
};
template<typename Tp, int N>
struct Rmq_mx {
static const int L = __lg(N - 1) + 1;
Tp ar[1 << L], t[L][1 << L];
int n;
Tp op(Tp l, Tp r) {
return max(l, r);
}
void bld(int n_, Tp *ar_) {
n = n_;
int h = n == 1 ? 0 : __lg(n - 1) + 1;
for (int i = 0; i < 1 << h; i++)
ar[i] = i < n ? ar_[i] : Tp();
bld(0, (1 << h) - 1, h - 1);
}
void bld(int l, int r, int h) {
if (h >= 0) {
int m = (l + r) / 2;
for (int i = m; i >= l; i--)
t[h][i] = i == m ? ar[i] : op(ar[i], t[h][i + 1]);
for (int i = m + 1; i <= r; i++)
t[h][i] = i == m + 1 ? ar[i] : op(t[h][i - 1], ar[i]);
bld(l, m, h - 1), bld(m + 1, r, h - 1);
}
}
Tp qry(int l, int r) {
l = max(l, 0);
r = min(r, n - 1);
if (l > r)
return INT_MIN;
if (l == r)
return ar[l];
int h = __lg(l ^ r);
return op(t[h][l], t[h][r]);
}
};
int n, u[N], v[N], v1[N + 1];
vi h;
Rmq_mx<int, N> rmq;
namespace s1 {
const int N_ = N * 18;
int s[N_], lc[N_], rc[N_], cnt = 0;
int cp(int k) {
int q = ++cnt;
s[q] = s[k], lc[q] = lc[k], rc[q] = rc[k];
return q;
}
void upd(int& k, int l, int r, int i) {
k = cp(k);
s[k]++;
if (l != r) {
int m = (l + r) / 2;
if (i <= m)
upd(lc[k], l, m, i);
else
upd(rc[k], m + 1, r, i);
}
}
int sm(int k, int l, int r, int ql, int qr) {
if (k == 0 || s[k] == 0 || ql > r || qr < l)
return 0;
if (ql <= l && qr >= r)
return s[k];
int m = (l + r) / 2;
return sm(lc[k], l, m, ql, qr) + sm(rc[k], m + 1, r, ql, qr);
}
int gl(int k, int l, int r, int i) {
if (l > i || s[k] == 0)
return -1;
if (l == r)
return l;
int m = (l + r) / 2, p = gl(rc[k], m + 1, r, i);
return p != -1 ? p : gl(lc[k], l, m, i);
}
int gr(int k, int l, int r, int i) {
if (r < i || s[k] == 0)
return -1;
if (l == r)
return l;
int m = (l + r) / 2, p = gr(lc[k], l, m, i);
return p != -1 ? p : gr(rc[k], m + 1, r, i);
}
void print(int k, int l, int r) {
if (k == 0)
return;
if (l == r) {
cout << l << ' ';
return;
}
int m = (l + r) / 2;
print(lc[k], l, m), print(rc[k], m + 1, r);
}
};
namespace s2 {
struct V {
int a, b, c;
} s[N * 4], T = {INF, 0, 0};
V op(V l, V r) {
return {min(l.a, r.a), max(l.b, r.b), max(r.b - l.a, max(l.c, r.c))};
}
void bld() {
for (int i = 0; i < n; i++)
s[n + i] = {h[i], h[i], 0};
for (int i = n - 1; i > 0; i--)
s[i] = op(s[i * 2], s[i * 2 + 1]);
}
int qry(int l, int r) {
V la = T, ra = T;
for (l += n, r += n; l <= r; l /= 2, r /= 2) {
if (l % 2 == 1)
la = op(la, s[l++]);
if (r % 2 == 0)
ra = op(s[r--], ra);
}
return op(la, ra).c;
}
int val(int l, int r) {
int x = INF;
for (l += n, r += n; l <= r; l /= 2, r /= 2) {
if (l % 2 == 1)
x = min(x, s[l++].a);
if (r % 2 == 0)
x = min(x, s[r--].a);
}
return x;
}
};
namespace s3 {
struct V {
int a, b, c;
} s[N * 4], T = {INF, 0, 0};
V op(V l, V r) {
return {min(l.a, r.a), max(l.b, r.b), max(l.b - r.a, max(l.c, r.c))};
}
void bld() {
for (int i = 0; i < n; i++)
s[n + i] = {h[i], h[i], 0};
for (int i = n - 1; i > 0; i--)
s[i] = op(s[i * 2], s[i * 2 + 1]);
}
int qry(int l, int r) {
V la = T, ra = T;
for (l += n, r += n; l <= r; l /= 2, r /= 2) {
if (l % 2 == 1)
la = op(la, s[l++]);
if (r % 2 == 0)
ra = op(s[r--], ra);
}
return op(la, ra).c;
}
int val(int l, int r) {
int x = INF;
for (l += n, r += n; l <= r; l /= 2, r /= 2) {
if (l % 2 == 1)
x = min(x, s[l++].a);
if (r % 2 == 0)
x = min(x, s[r--].a);
}
return x;
}
};
void init(int n_, vi h_) {
n = n_;
h = h_;
rmq.bld(n, h.data());
vi s;
fill(v, v + n, INF);
for (int i = 0; i < n; i++) {
while (!s.empty() && h[s.back()] >= h[i])
s.pop_back();
if (!s.empty())
v[i] = min(v[i], rmq.qry(s.back(), i) - h[i]);
s.push_back(i);
}
s.clear();
for (int i = n - 1; i >= 0; i--) {
while (!s.empty() && h[s.back()] >= h[i])
s.pop_back();
if (!s.empty())
v[i] = min(v[i], rmq.qry(i, s.back()) - h[i]);
s.push_back(i);
}
s.clear();
iota(u, u + n, 0);
sort(u, u + n, [&](int i, int j) {
return v[i] > v[j];
});
v1[0] = 0;
for (int i = 0; i < n; i++) {
v1[i + 1] = v1[i];
s1::upd(v1[i + 1], 0, n - 1, u[i]);
}
s2::bld();
s3::bld();
}
int Gl(int i, int d) {
if (rmq.qry(1, i) < h[i] + d)
return -1;
int low = 0, hi = i - 1;
while (low < hi) {
int t = (low + hi) / 2 + 1;
if (rmq.qry(t + 1, i) >= h[i] + d)
low = t;
else
hi = t - 1;
}
return low;
}
int Gr(int i, int d) {
if (rmq.qry(i, n - 2) < h[i] + d)
return n;
int low = i + 1, hi = n - 1;
while (low < hi) {
int t = (low + hi) / 2;
if (rmq.qry(i, t - 1) >= h[i] + d)
hi = t;
else
low = t + 1;
}
return low;
}
int max_towers(int l, int r, int d) {
int low = 1, hi = n;
while (low < hi) {
int t = (low + hi) / 2 + 1;
if (v[u[t - 1]] >= d)
low = t;
else
hi = t - 1;
}
int x = s1::sm(v1[low], 0, n - 1, l, r);
int L = s1::gr(v1[low], 0, n - 1, l);
if (L != -1) {
int l_ = Gl(L, d);
if (s2::qry(l, l_) >= d || (l <= l_ && rmq.qry(max(l, l_), L) - s2::val(l, l_) >= d)) {
x++;
debug(L, l_);
}
}
int R = s1::gl(v1[low], 0, n - 1, r);
if (R != -1) {
int r_ = Gr(R, d);
if (s3::qry(r_, r) >= d || (r_ <= r && rmq.qry(R, min(r, r_)) - s3::val(r_, r) >= d)) {
x++;
debug(R, r_);
}
}
return max(1, x);
}
Compilation message
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:8:22: warning: statement has no effect [-Wunused-value]
8 | #define debug(...) 0
| ^
towers.cpp:293:7: note: in expansion of macro 'debug'
293 | debug(L, l_);
| ^~~~~
towers.cpp:8:22: warning: statement has no effect [-Wunused-value]
8 | #define debug(...) 0
| ^
towers.cpp:301:7: note: in expansion of macro 'debug'
301 | debug(R, r_);
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
511 ms |
21056 KB |
Output is correct |
2 |
Correct |
1030 ms |
37916 KB |
Output is correct |
3 |
Correct |
1100 ms |
37756 KB |
Output is correct |
4 |
Correct |
905 ms |
37812 KB |
Output is correct |
5 |
Correct |
933 ms |
37784 KB |
Output is correct |
6 |
Correct |
1004 ms |
37824 KB |
Output is correct |
7 |
Correct |
978 ms |
37772 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
464 KB |
Output is correct |
2 |
Correct |
1 ms |
848 KB |
Output is correct |
3 |
Correct |
2 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
824 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
1 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
848 KB |
Output is correct |
9 |
Correct |
1 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
848 KB |
Output is correct |
14 |
Correct |
1 ms |
848 KB |
Output is correct |
15 |
Correct |
1 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
1 ms |
848 KB |
Output is correct |
21 |
Correct |
1 ms |
848 KB |
Output is correct |
22 |
Correct |
1 ms |
848 KB |
Output is correct |
23 |
Correct |
1 ms |
848 KB |
Output is correct |
24 |
Correct |
1 ms |
848 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
2 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
848 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
464 KB |
Output is correct |
2 |
Correct |
1 ms |
848 KB |
Output is correct |
3 |
Correct |
2 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
824 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
1 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
848 KB |
Output is correct |
9 |
Correct |
1 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
848 KB |
Output is correct |
14 |
Correct |
1 ms |
848 KB |
Output is correct |
15 |
Correct |
1 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
1 ms |
848 KB |
Output is correct |
21 |
Correct |
1 ms |
848 KB |
Output is correct |
22 |
Correct |
1 ms |
848 KB |
Output is correct |
23 |
Correct |
1 ms |
848 KB |
Output is correct |
24 |
Correct |
1 ms |
848 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
2 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
848 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
848 KB |
Output is correct |
36 |
Correct |
31 ms |
22344 KB |
Output is correct |
37 |
Correct |
58 ms |
37308 KB |
Output is correct |
38 |
Correct |
57 ms |
37308 KB |
Output is correct |
39 |
Correct |
61 ms |
37288 KB |
Output is correct |
40 |
Correct |
62 ms |
37320 KB |
Output is correct |
41 |
Correct |
66 ms |
37284 KB |
Output is correct |
42 |
Correct |
56 ms |
37288 KB |
Output is correct |
43 |
Correct |
42 ms |
37788 KB |
Output is correct |
44 |
Correct |
48 ms |
37780 KB |
Output is correct |
45 |
Correct |
49 ms |
37664 KB |
Output is correct |
46 |
Correct |
41 ms |
37680 KB |
Output is correct |
47 |
Correct |
55 ms |
37372 KB |
Output is correct |
48 |
Correct |
51 ms |
37304 KB |
Output is correct |
49 |
Correct |
67 ms |
37252 KB |
Output is correct |
50 |
Correct |
46 ms |
37780 KB |
Output is correct |
51 |
Correct |
49 ms |
37792 KB |
Output is correct |
52 |
Correct |
49 ms |
37412 KB |
Output is correct |
53 |
Correct |
55 ms |
37424 KB |
Output is correct |
54 |
Correct |
56 ms |
37256 KB |
Output is correct |
55 |
Correct |
47 ms |
37864 KB |
Output is correct |
56 |
Correct |
47 ms |
37692 KB |
Output is correct |
57 |
Correct |
48 ms |
36344 KB |
Output is correct |
58 |
Correct |
59 ms |
37244 KB |
Output is correct |
59 |
Correct |
53 ms |
37340 KB |
Output is correct |
60 |
Correct |
55 ms |
37336 KB |
Output is correct |
61 |
Correct |
61 ms |
37272 KB |
Output is correct |
62 |
Correct |
52 ms |
37288 KB |
Output is correct |
63 |
Correct |
53 ms |
37256 KB |
Output is correct |
64 |
Correct |
41 ms |
37812 KB |
Output is correct |
65 |
Correct |
51 ms |
37800 KB |
Output is correct |
66 |
Correct |
46 ms |
37720 KB |
Output is correct |
67 |
Correct |
41 ms |
37792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1000 ms |
37136 KB |
Output is correct |
2 |
Correct |
1161 ms |
37320 KB |
Output is correct |
3 |
Correct |
1305 ms |
37420 KB |
Output is correct |
4 |
Correct |
1148 ms |
37356 KB |
Output is correct |
5 |
Correct |
1240 ms |
37352 KB |
Output is correct |
6 |
Correct |
1323 ms |
37296 KB |
Output is correct |
7 |
Correct |
1171 ms |
37280 KB |
Output is correct |
8 |
Correct |
930 ms |
37812 KB |
Output is correct |
9 |
Correct |
937 ms |
37800 KB |
Output is correct |
10 |
Correct |
907 ms |
37696 KB |
Output is correct |
11 |
Correct |
1039 ms |
37660 KB |
Output is correct |
12 |
Correct |
1100 ms |
37824 KB |
Output is correct |
13 |
Correct |
1024 ms |
37860 KB |
Output is correct |
14 |
Correct |
0 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
848 KB |
Output is correct |
16 |
Correct |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
53 ms |
37340 KB |
Output is correct |
18 |
Correct |
60 ms |
37260 KB |
Output is correct |
19 |
Correct |
63 ms |
37324 KB |
Output is correct |
20 |
Correct |
41 ms |
37792 KB |
Output is correct |
21 |
Correct |
42 ms |
37792 KB |
Output is correct |
22 |
Correct |
59 ms |
37356 KB |
Output is correct |
23 |
Correct |
65 ms |
37332 KB |
Output is correct |
24 |
Correct |
56 ms |
37268 KB |
Output is correct |
25 |
Correct |
49 ms |
37812 KB |
Output is correct |
26 |
Correct |
50 ms |
37672 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
1 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
848 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
848 KB |
Output is correct |
36 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
330 ms |
8524 KB |
Output is correct |
2 |
Correct |
1064 ms |
37320 KB |
Output is correct |
3 |
Correct |
1170 ms |
37348 KB |
Output is correct |
4 |
Correct |
1018 ms |
37280 KB |
Output is correct |
5 |
Correct |
1057 ms |
37280 KB |
Output is correct |
6 |
Correct |
902 ms |
37292 KB |
Output is correct |
7 |
Correct |
1004 ms |
37344 KB |
Output is correct |
8 |
Correct |
1123 ms |
37916 KB |
Output is correct |
9 |
Correct |
1041 ms |
37800 KB |
Output is correct |
10 |
Correct |
1016 ms |
37796 KB |
Output is correct |
11 |
Correct |
961 ms |
37744 KB |
Output is correct |
12 |
Correct |
55 ms |
37352 KB |
Output is correct |
13 |
Correct |
63 ms |
37316 KB |
Output is correct |
14 |
Correct |
58 ms |
37344 KB |
Output is correct |
15 |
Correct |
44 ms |
37824 KB |
Output is correct |
16 |
Correct |
41 ms |
37656 KB |
Output is correct |
17 |
Correct |
49 ms |
36360 KB |
Output is correct |
18 |
Correct |
50 ms |
37352 KB |
Output is correct |
19 |
Correct |
52 ms |
37288 KB |
Output is correct |
20 |
Correct |
62 ms |
37320 KB |
Output is correct |
21 |
Correct |
55 ms |
37272 KB |
Output is correct |
22 |
Correct |
57 ms |
37348 KB |
Output is correct |
23 |
Correct |
59 ms |
37320 KB |
Output is correct |
24 |
Correct |
52 ms |
37852 KB |
Output is correct |
25 |
Correct |
42 ms |
37924 KB |
Output is correct |
26 |
Correct |
46 ms |
37836 KB |
Output is correct |
27 |
Correct |
50 ms |
37816 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
1 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
592 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
848 KB |
Output is correct |
36 |
Correct |
1 ms |
848 KB |
Output is correct |
37 |
Correct |
1 ms |
848 KB |
Output is correct |
38 |
Correct |
1 ms |
848 KB |
Output is correct |
39 |
Correct |
1 ms |
848 KB |
Output is correct |
40 |
Correct |
1 ms |
848 KB |
Output is correct |
41 |
Correct |
1 ms |
848 KB |
Output is correct |
42 |
Correct |
2 ms |
848 KB |
Output is correct |
43 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
464 KB |
Output is correct |
2 |
Correct |
1 ms |
848 KB |
Output is correct |
3 |
Correct |
2 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
824 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
1 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
848 KB |
Output is correct |
9 |
Correct |
1 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
2 ms |
848 KB |
Output is correct |
14 |
Correct |
1 ms |
848 KB |
Output is correct |
15 |
Correct |
1 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
1 ms |
848 KB |
Output is correct |
21 |
Correct |
1 ms |
848 KB |
Output is correct |
22 |
Correct |
1 ms |
848 KB |
Output is correct |
23 |
Correct |
1 ms |
848 KB |
Output is correct |
24 |
Correct |
1 ms |
848 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
2 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
848 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
848 KB |
Output is correct |
36 |
Correct |
31 ms |
22344 KB |
Output is correct |
37 |
Correct |
58 ms |
37308 KB |
Output is correct |
38 |
Correct |
57 ms |
37308 KB |
Output is correct |
39 |
Correct |
61 ms |
37288 KB |
Output is correct |
40 |
Correct |
62 ms |
37320 KB |
Output is correct |
41 |
Correct |
66 ms |
37284 KB |
Output is correct |
42 |
Correct |
56 ms |
37288 KB |
Output is correct |
43 |
Correct |
42 ms |
37788 KB |
Output is correct |
44 |
Correct |
48 ms |
37780 KB |
Output is correct |
45 |
Correct |
49 ms |
37664 KB |
Output is correct |
46 |
Correct |
41 ms |
37680 KB |
Output is correct |
47 |
Correct |
55 ms |
37372 KB |
Output is correct |
48 |
Correct |
51 ms |
37304 KB |
Output is correct |
49 |
Correct |
67 ms |
37252 KB |
Output is correct |
50 |
Correct |
46 ms |
37780 KB |
Output is correct |
51 |
Correct |
49 ms |
37792 KB |
Output is correct |
52 |
Correct |
49 ms |
37412 KB |
Output is correct |
53 |
Correct |
55 ms |
37424 KB |
Output is correct |
54 |
Correct |
56 ms |
37256 KB |
Output is correct |
55 |
Correct |
47 ms |
37864 KB |
Output is correct |
56 |
Correct |
47 ms |
37692 KB |
Output is correct |
57 |
Correct |
48 ms |
36344 KB |
Output is correct |
58 |
Correct |
59 ms |
37244 KB |
Output is correct |
59 |
Correct |
53 ms |
37340 KB |
Output is correct |
60 |
Correct |
55 ms |
37336 KB |
Output is correct |
61 |
Correct |
61 ms |
37272 KB |
Output is correct |
62 |
Correct |
52 ms |
37288 KB |
Output is correct |
63 |
Correct |
53 ms |
37256 KB |
Output is correct |
64 |
Correct |
41 ms |
37812 KB |
Output is correct |
65 |
Correct |
51 ms |
37800 KB |
Output is correct |
66 |
Correct |
46 ms |
37720 KB |
Output is correct |
67 |
Correct |
41 ms |
37792 KB |
Output is correct |
68 |
Correct |
1000 ms |
37136 KB |
Output is correct |
69 |
Correct |
1161 ms |
37320 KB |
Output is correct |
70 |
Correct |
1305 ms |
37420 KB |
Output is correct |
71 |
Correct |
1148 ms |
37356 KB |
Output is correct |
72 |
Correct |
1240 ms |
37352 KB |
Output is correct |
73 |
Correct |
1323 ms |
37296 KB |
Output is correct |
74 |
Correct |
1171 ms |
37280 KB |
Output is correct |
75 |
Correct |
930 ms |
37812 KB |
Output is correct |
76 |
Correct |
937 ms |
37800 KB |
Output is correct |
77 |
Correct |
907 ms |
37696 KB |
Output is correct |
78 |
Correct |
1039 ms |
37660 KB |
Output is correct |
79 |
Correct |
1100 ms |
37824 KB |
Output is correct |
80 |
Correct |
1024 ms |
37860 KB |
Output is correct |
81 |
Correct |
0 ms |
336 KB |
Output is correct |
82 |
Correct |
1 ms |
848 KB |
Output is correct |
83 |
Correct |
1 ms |
848 KB |
Output is correct |
84 |
Correct |
53 ms |
37340 KB |
Output is correct |
85 |
Correct |
60 ms |
37260 KB |
Output is correct |
86 |
Correct |
63 ms |
37324 KB |
Output is correct |
87 |
Correct |
41 ms |
37792 KB |
Output is correct |
88 |
Correct |
42 ms |
37792 KB |
Output is correct |
89 |
Correct |
59 ms |
37356 KB |
Output is correct |
90 |
Correct |
65 ms |
37332 KB |
Output is correct |
91 |
Correct |
56 ms |
37268 KB |
Output is correct |
92 |
Correct |
49 ms |
37812 KB |
Output is correct |
93 |
Correct |
50 ms |
37672 KB |
Output is correct |
94 |
Correct |
1 ms |
848 KB |
Output is correct |
95 |
Correct |
1 ms |
848 KB |
Output is correct |
96 |
Correct |
1 ms |
848 KB |
Output is correct |
97 |
Correct |
1 ms |
848 KB |
Output is correct |
98 |
Correct |
1 ms |
848 KB |
Output is correct |
99 |
Correct |
1 ms |
848 KB |
Output is correct |
100 |
Correct |
1 ms |
848 KB |
Output is correct |
101 |
Correct |
1 ms |
848 KB |
Output is correct |
102 |
Correct |
1 ms |
848 KB |
Output is correct |
103 |
Correct |
1 ms |
848 KB |
Output is correct |
104 |
Correct |
957 ms |
34032 KB |
Output is correct |
105 |
Correct |
1340 ms |
37248 KB |
Output is correct |
106 |
Correct |
1311 ms |
37284 KB |
Output is correct |
107 |
Correct |
1128 ms |
37316 KB |
Output is correct |
108 |
Correct |
1091 ms |
37276 KB |
Output is correct |
109 |
Correct |
1221 ms |
37320 KB |
Output is correct |
110 |
Correct |
1279 ms |
37288 KB |
Output is correct |
111 |
Correct |
1043 ms |
37824 KB |
Output is correct |
112 |
Correct |
1008 ms |
37812 KB |
Output is correct |
113 |
Correct |
1095 ms |
37700 KB |
Output is correct |
114 |
Correct |
937 ms |
37812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
511 ms |
21056 KB |
Output is correct |
2 |
Correct |
1030 ms |
37916 KB |
Output is correct |
3 |
Correct |
1100 ms |
37756 KB |
Output is correct |
4 |
Correct |
905 ms |
37812 KB |
Output is correct |
5 |
Correct |
933 ms |
37784 KB |
Output is correct |
6 |
Correct |
1004 ms |
37824 KB |
Output is correct |
7 |
Correct |
978 ms |
37772 KB |
Output is correct |
8 |
Correct |
0 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
848 KB |
Output is correct |
11 |
Correct |
0 ms |
464 KB |
Output is correct |
12 |
Correct |
1 ms |
848 KB |
Output is correct |
13 |
Correct |
2 ms |
848 KB |
Output is correct |
14 |
Correct |
1 ms |
848 KB |
Output is correct |
15 |
Correct |
1 ms |
824 KB |
Output is correct |
16 |
Correct |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
1 ms |
860 KB |
Output is correct |
21 |
Correct |
1 ms |
848 KB |
Output is correct |
22 |
Correct |
0 ms |
336 KB |
Output is correct |
23 |
Correct |
2 ms |
848 KB |
Output is correct |
24 |
Correct |
1 ms |
848 KB |
Output is correct |
25 |
Correct |
1 ms |
848 KB |
Output is correct |
26 |
Correct |
2 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
848 KB |
Output is correct |
29 |
Correct |
1 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
848 KB |
Output is correct |
33 |
Correct |
1 ms |
848 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
592 KB |
Output is correct |
36 |
Correct |
1 ms |
848 KB |
Output is correct |
37 |
Correct |
1 ms |
848 KB |
Output is correct |
38 |
Correct |
1 ms |
848 KB |
Output is correct |
39 |
Correct |
2 ms |
848 KB |
Output is correct |
40 |
Correct |
1 ms |
848 KB |
Output is correct |
41 |
Correct |
1 ms |
848 KB |
Output is correct |
42 |
Correct |
1 ms |
848 KB |
Output is correct |
43 |
Correct |
1 ms |
848 KB |
Output is correct |
44 |
Correct |
1 ms |
848 KB |
Output is correct |
45 |
Correct |
1 ms |
848 KB |
Output is correct |
46 |
Correct |
31 ms |
22344 KB |
Output is correct |
47 |
Correct |
58 ms |
37308 KB |
Output is correct |
48 |
Correct |
57 ms |
37308 KB |
Output is correct |
49 |
Correct |
61 ms |
37288 KB |
Output is correct |
50 |
Correct |
62 ms |
37320 KB |
Output is correct |
51 |
Correct |
66 ms |
37284 KB |
Output is correct |
52 |
Correct |
56 ms |
37288 KB |
Output is correct |
53 |
Correct |
42 ms |
37788 KB |
Output is correct |
54 |
Correct |
48 ms |
37780 KB |
Output is correct |
55 |
Correct |
49 ms |
37664 KB |
Output is correct |
56 |
Correct |
41 ms |
37680 KB |
Output is correct |
57 |
Correct |
55 ms |
37372 KB |
Output is correct |
58 |
Correct |
51 ms |
37304 KB |
Output is correct |
59 |
Correct |
67 ms |
37252 KB |
Output is correct |
60 |
Correct |
46 ms |
37780 KB |
Output is correct |
61 |
Correct |
49 ms |
37792 KB |
Output is correct |
62 |
Correct |
49 ms |
37412 KB |
Output is correct |
63 |
Correct |
55 ms |
37424 KB |
Output is correct |
64 |
Correct |
56 ms |
37256 KB |
Output is correct |
65 |
Correct |
47 ms |
37864 KB |
Output is correct |
66 |
Correct |
47 ms |
37692 KB |
Output is correct |
67 |
Correct |
48 ms |
36344 KB |
Output is correct |
68 |
Correct |
59 ms |
37244 KB |
Output is correct |
69 |
Correct |
53 ms |
37340 KB |
Output is correct |
70 |
Correct |
55 ms |
37336 KB |
Output is correct |
71 |
Correct |
61 ms |
37272 KB |
Output is correct |
72 |
Correct |
52 ms |
37288 KB |
Output is correct |
73 |
Correct |
53 ms |
37256 KB |
Output is correct |
74 |
Correct |
41 ms |
37812 KB |
Output is correct |
75 |
Correct |
51 ms |
37800 KB |
Output is correct |
76 |
Correct |
46 ms |
37720 KB |
Output is correct |
77 |
Correct |
41 ms |
37792 KB |
Output is correct |
78 |
Correct |
1000 ms |
37136 KB |
Output is correct |
79 |
Correct |
1161 ms |
37320 KB |
Output is correct |
80 |
Correct |
1305 ms |
37420 KB |
Output is correct |
81 |
Correct |
1148 ms |
37356 KB |
Output is correct |
82 |
Correct |
1240 ms |
37352 KB |
Output is correct |
83 |
Correct |
1323 ms |
37296 KB |
Output is correct |
84 |
Correct |
1171 ms |
37280 KB |
Output is correct |
85 |
Correct |
930 ms |
37812 KB |
Output is correct |
86 |
Correct |
937 ms |
37800 KB |
Output is correct |
87 |
Correct |
907 ms |
37696 KB |
Output is correct |
88 |
Correct |
1039 ms |
37660 KB |
Output is correct |
89 |
Correct |
1100 ms |
37824 KB |
Output is correct |
90 |
Correct |
1024 ms |
37860 KB |
Output is correct |
91 |
Correct |
0 ms |
336 KB |
Output is correct |
92 |
Correct |
1 ms |
848 KB |
Output is correct |
93 |
Correct |
1 ms |
848 KB |
Output is correct |
94 |
Correct |
53 ms |
37340 KB |
Output is correct |
95 |
Correct |
60 ms |
37260 KB |
Output is correct |
96 |
Correct |
63 ms |
37324 KB |
Output is correct |
97 |
Correct |
41 ms |
37792 KB |
Output is correct |
98 |
Correct |
42 ms |
37792 KB |
Output is correct |
99 |
Correct |
59 ms |
37356 KB |
Output is correct |
100 |
Correct |
65 ms |
37332 KB |
Output is correct |
101 |
Correct |
56 ms |
37268 KB |
Output is correct |
102 |
Correct |
49 ms |
37812 KB |
Output is correct |
103 |
Correct |
50 ms |
37672 KB |
Output is correct |
104 |
Correct |
1 ms |
848 KB |
Output is correct |
105 |
Correct |
1 ms |
848 KB |
Output is correct |
106 |
Correct |
1 ms |
848 KB |
Output is correct |
107 |
Correct |
1 ms |
848 KB |
Output is correct |
108 |
Correct |
1 ms |
848 KB |
Output is correct |
109 |
Correct |
1 ms |
848 KB |
Output is correct |
110 |
Correct |
1 ms |
848 KB |
Output is correct |
111 |
Correct |
1 ms |
848 KB |
Output is correct |
112 |
Correct |
1 ms |
848 KB |
Output is correct |
113 |
Correct |
1 ms |
848 KB |
Output is correct |
114 |
Correct |
330 ms |
8524 KB |
Output is correct |
115 |
Correct |
1064 ms |
37320 KB |
Output is correct |
116 |
Correct |
1170 ms |
37348 KB |
Output is correct |
117 |
Correct |
1018 ms |
37280 KB |
Output is correct |
118 |
Correct |
1057 ms |
37280 KB |
Output is correct |
119 |
Correct |
902 ms |
37292 KB |
Output is correct |
120 |
Correct |
1004 ms |
37344 KB |
Output is correct |
121 |
Correct |
1123 ms |
37916 KB |
Output is correct |
122 |
Correct |
1041 ms |
37800 KB |
Output is correct |
123 |
Correct |
1016 ms |
37796 KB |
Output is correct |
124 |
Correct |
961 ms |
37744 KB |
Output is correct |
125 |
Correct |
55 ms |
37352 KB |
Output is correct |
126 |
Correct |
63 ms |
37316 KB |
Output is correct |
127 |
Correct |
58 ms |
37344 KB |
Output is correct |
128 |
Correct |
44 ms |
37824 KB |
Output is correct |
129 |
Correct |
41 ms |
37656 KB |
Output is correct |
130 |
Correct |
49 ms |
36360 KB |
Output is correct |
131 |
Correct |
50 ms |
37352 KB |
Output is correct |
132 |
Correct |
52 ms |
37288 KB |
Output is correct |
133 |
Correct |
62 ms |
37320 KB |
Output is correct |
134 |
Correct |
55 ms |
37272 KB |
Output is correct |
135 |
Correct |
57 ms |
37348 KB |
Output is correct |
136 |
Correct |
59 ms |
37320 KB |
Output is correct |
137 |
Correct |
52 ms |
37852 KB |
Output is correct |
138 |
Correct |
42 ms |
37924 KB |
Output is correct |
139 |
Correct |
46 ms |
37836 KB |
Output is correct |
140 |
Correct |
50 ms |
37816 KB |
Output is correct |
141 |
Correct |
1 ms |
848 KB |
Output is correct |
142 |
Correct |
1 ms |
848 KB |
Output is correct |
143 |
Correct |
1 ms |
848 KB |
Output is correct |
144 |
Correct |
1 ms |
848 KB |
Output is correct |
145 |
Correct |
1 ms |
848 KB |
Output is correct |
146 |
Correct |
1 ms |
592 KB |
Output is correct |
147 |
Correct |
1 ms |
848 KB |
Output is correct |
148 |
Correct |
1 ms |
848 KB |
Output is correct |
149 |
Correct |
1 ms |
848 KB |
Output is correct |
150 |
Correct |
1 ms |
848 KB |
Output is correct |
151 |
Correct |
1 ms |
848 KB |
Output is correct |
152 |
Correct |
1 ms |
848 KB |
Output is correct |
153 |
Correct |
1 ms |
848 KB |
Output is correct |
154 |
Correct |
1 ms |
848 KB |
Output is correct |
155 |
Correct |
2 ms |
848 KB |
Output is correct |
156 |
Correct |
1 ms |
848 KB |
Output is correct |
157 |
Correct |
957 ms |
34032 KB |
Output is correct |
158 |
Correct |
1340 ms |
37248 KB |
Output is correct |
159 |
Correct |
1311 ms |
37284 KB |
Output is correct |
160 |
Correct |
1128 ms |
37316 KB |
Output is correct |
161 |
Correct |
1091 ms |
37276 KB |
Output is correct |
162 |
Correct |
1221 ms |
37320 KB |
Output is correct |
163 |
Correct |
1279 ms |
37288 KB |
Output is correct |
164 |
Correct |
1043 ms |
37824 KB |
Output is correct |
165 |
Correct |
1008 ms |
37812 KB |
Output is correct |
166 |
Correct |
1095 ms |
37700 KB |
Output is correct |
167 |
Correct |
937 ms |
37812 KB |
Output is correct |
168 |
Correct |
0 ms |
336 KB |
Output is correct |
169 |
Correct |
816 ms |
13708 KB |
Output is correct |
170 |
Correct |
1460 ms |
37312 KB |
Output is correct |
171 |
Correct |
1375 ms |
37320 KB |
Output is correct |
172 |
Correct |
1509 ms |
37288 KB |
Output is correct |
173 |
Correct |
1475 ms |
37280 KB |
Output is correct |
174 |
Correct |
1339 ms |
37268 KB |
Output is correct |
175 |
Correct |
1308 ms |
37284 KB |
Output is correct |
176 |
Correct |
982 ms |
37800 KB |
Output is correct |
177 |
Correct |
923 ms |
37820 KB |
Output is correct |
178 |
Correct |
1139 ms |
37816 KB |
Output is correct |
179 |
Correct |
989 ms |
37540 KB |
Output is correct |