#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "lib/debug.h"
#else
#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:7:22: warning: statement has no effect [-Wunused-value]
7 | #define debug(...) 0
| ^
towers.cpp:292:7: note: in expansion of macro 'debug'
292 | debug(L, l_);
| ^~~~~
towers.cpp:7:22: warning: statement has no effect [-Wunused-value]
7 | #define debug(...) 0
| ^
towers.cpp:300:7: note: in expansion of macro 'debug'
300 | debug(R, r_);
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
609 ms |
21032 KB |
Output is correct |
2 |
Correct |
1279 ms |
37812 KB |
Output is correct |
3 |
Correct |
1366 ms |
37808 KB |
Output is correct |
4 |
Correct |
1046 ms |
37796 KB |
Output is correct |
5 |
Correct |
1018 ms |
37796 KB |
Output is correct |
6 |
Correct |
1018 ms |
37788 KB |
Output is correct |
7 |
Correct |
924 ms |
37788 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 |
1 ms |
464 KB |
Output is correct |
2 |
Correct |
2 ms |
848 KB |
Output is correct |
3 |
Correct |
1 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
848 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
2 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 |
848 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
1 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 |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
2 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
2 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 |
928 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
464 KB |
Output is correct |
2 |
Correct |
2 ms |
848 KB |
Output is correct |
3 |
Correct |
1 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
848 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
2 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 |
848 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
1 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 |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
2 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
2 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 |
928 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 |
30 ms |
22324 KB |
Output is correct |
37 |
Correct |
58 ms |
37332 KB |
Output is correct |
38 |
Correct |
53 ms |
37256 KB |
Output is correct |
39 |
Correct |
59 ms |
37280 KB |
Output is correct |
40 |
Correct |
54 ms |
37340 KB |
Output is correct |
41 |
Correct |
55 ms |
37352 KB |
Output is correct |
42 |
Correct |
68 ms |
37264 KB |
Output is correct |
43 |
Correct |
56 ms |
37808 KB |
Output is correct |
44 |
Correct |
48 ms |
37768 KB |
Output is correct |
45 |
Correct |
49 ms |
37688 KB |
Output is correct |
46 |
Correct |
42 ms |
37648 KB |
Output is correct |
47 |
Correct |
58 ms |
37284 KB |
Output is correct |
48 |
Correct |
69 ms |
37284 KB |
Output is correct |
49 |
Correct |
75 ms |
37288 KB |
Output is correct |
50 |
Correct |
41 ms |
37792 KB |
Output is correct |
51 |
Correct |
42 ms |
37772 KB |
Output is correct |
52 |
Correct |
50 ms |
37312 KB |
Output is correct |
53 |
Correct |
65 ms |
37340 KB |
Output is correct |
54 |
Correct |
67 ms |
37320 KB |
Output is correct |
55 |
Correct |
53 ms |
37788 KB |
Output is correct |
56 |
Correct |
41 ms |
37668 KB |
Output is correct |
57 |
Correct |
52 ms |
36416 KB |
Output is correct |
58 |
Correct |
50 ms |
37336 KB |
Output is correct |
59 |
Correct |
54 ms |
37352 KB |
Output is correct |
60 |
Correct |
68 ms |
37288 KB |
Output is correct |
61 |
Correct |
58 ms |
37292 KB |
Output is correct |
62 |
Correct |
55 ms |
37288 KB |
Output is correct |
63 |
Correct |
55 ms |
37336 KB |
Output is correct |
64 |
Correct |
43 ms |
37856 KB |
Output is correct |
65 |
Correct |
43 ms |
37812 KB |
Output is correct |
66 |
Correct |
41 ms |
37700 KB |
Output is correct |
67 |
Correct |
41 ms |
37800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1008 ms |
37084 KB |
Output is correct |
2 |
Correct |
1272 ms |
37308 KB |
Output is correct |
3 |
Correct |
1195 ms |
37344 KB |
Output is correct |
4 |
Correct |
1090 ms |
37436 KB |
Output is correct |
5 |
Correct |
1229 ms |
37276 KB |
Output is correct |
6 |
Correct |
1320 ms |
37348 KB |
Output is correct |
7 |
Correct |
1069 ms |
37364 KB |
Output is correct |
8 |
Correct |
950 ms |
37804 KB |
Output is correct |
9 |
Correct |
1018 ms |
37952 KB |
Output is correct |
10 |
Correct |
1046 ms |
37760 KB |
Output is correct |
11 |
Correct |
1086 ms |
37696 KB |
Output is correct |
12 |
Correct |
966 ms |
37804 KB |
Output is correct |
13 |
Correct |
1075 ms |
37900 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 |
55 ms |
37292 KB |
Output is correct |
18 |
Correct |
61 ms |
37272 KB |
Output is correct |
19 |
Correct |
68 ms |
37296 KB |
Output is correct |
20 |
Correct |
42 ms |
37824 KB |
Output is correct |
21 |
Correct |
41 ms |
37792 KB |
Output is correct |
22 |
Correct |
61 ms |
37348 KB |
Output is correct |
23 |
Correct |
60 ms |
37296 KB |
Output is correct |
24 |
Correct |
66 ms |
37288 KB |
Output is correct |
25 |
Correct |
48 ms |
37800 KB |
Output is correct |
26 |
Correct |
43 ms |
37668 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 |
2 ms |
848 KB |
Output is correct |
36 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
8528 KB |
Output is correct |
2 |
Correct |
981 ms |
37268 KB |
Output is correct |
3 |
Correct |
1053 ms |
37288 KB |
Output is correct |
4 |
Correct |
1080 ms |
37264 KB |
Output is correct |
5 |
Correct |
1020 ms |
37292 KB |
Output is correct |
6 |
Correct |
1058 ms |
37316 KB |
Output is correct |
7 |
Correct |
1150 ms |
37328 KB |
Output is correct |
8 |
Correct |
1132 ms |
37852 KB |
Output is correct |
9 |
Correct |
756 ms |
37824 KB |
Output is correct |
10 |
Correct |
1105 ms |
37696 KB |
Output is correct |
11 |
Correct |
1160 ms |
37812 KB |
Output is correct |
12 |
Correct |
54 ms |
37264 KB |
Output is correct |
13 |
Correct |
58 ms |
37244 KB |
Output is correct |
14 |
Correct |
61 ms |
37288 KB |
Output is correct |
15 |
Correct |
43 ms |
37824 KB |
Output is correct |
16 |
Correct |
41 ms |
37648 KB |
Output is correct |
17 |
Correct |
51 ms |
36372 KB |
Output is correct |
18 |
Correct |
52 ms |
37340 KB |
Output is correct |
19 |
Correct |
54 ms |
37308 KB |
Output is correct |
20 |
Correct |
59 ms |
37344 KB |
Output is correct |
21 |
Correct |
65 ms |
37344 KB |
Output is correct |
22 |
Correct |
59 ms |
37296 KB |
Output is correct |
23 |
Correct |
55 ms |
37296 KB |
Output is correct |
24 |
Correct |
42 ms |
37800 KB |
Output is correct |
25 |
Correct |
41 ms |
37828 KB |
Output is correct |
26 |
Correct |
46 ms |
37676 KB |
Output is correct |
27 |
Correct |
51 ms |
37812 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 |
2 ms |
592 KB |
Output is correct |
34 |
Correct |
1 ms |
848 KB |
Output is correct |
35 |
Correct |
2 ms |
824 KB |
Output is correct |
36 |
Correct |
1 ms |
840 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 |
1 ms |
848 KB |
Output is correct |
43 |
Correct |
1 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
464 KB |
Output is correct |
2 |
Correct |
2 ms |
848 KB |
Output is correct |
3 |
Correct |
1 ms |
848 KB |
Output is correct |
4 |
Correct |
1 ms |
848 KB |
Output is correct |
5 |
Correct |
1 ms |
848 KB |
Output is correct |
6 |
Correct |
1 ms |
848 KB |
Output is correct |
7 |
Correct |
2 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 |
848 KB |
Output is correct |
11 |
Correct |
1 ms |
848 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
1 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 |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
1 ms |
848 KB |
Output is correct |
18 |
Correct |
2 ms |
848 KB |
Output is correct |
19 |
Correct |
1 ms |
848 KB |
Output is correct |
20 |
Correct |
2 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 |
928 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 |
30 ms |
22324 KB |
Output is correct |
37 |
Correct |
58 ms |
37332 KB |
Output is correct |
38 |
Correct |
53 ms |
37256 KB |
Output is correct |
39 |
Correct |
59 ms |
37280 KB |
Output is correct |
40 |
Correct |
54 ms |
37340 KB |
Output is correct |
41 |
Correct |
55 ms |
37352 KB |
Output is correct |
42 |
Correct |
68 ms |
37264 KB |
Output is correct |
43 |
Correct |
56 ms |
37808 KB |
Output is correct |
44 |
Correct |
48 ms |
37768 KB |
Output is correct |
45 |
Correct |
49 ms |
37688 KB |
Output is correct |
46 |
Correct |
42 ms |
37648 KB |
Output is correct |
47 |
Correct |
58 ms |
37284 KB |
Output is correct |
48 |
Correct |
69 ms |
37284 KB |
Output is correct |
49 |
Correct |
75 ms |
37288 KB |
Output is correct |
50 |
Correct |
41 ms |
37792 KB |
Output is correct |
51 |
Correct |
42 ms |
37772 KB |
Output is correct |
52 |
Correct |
50 ms |
37312 KB |
Output is correct |
53 |
Correct |
65 ms |
37340 KB |
Output is correct |
54 |
Correct |
67 ms |
37320 KB |
Output is correct |
55 |
Correct |
53 ms |
37788 KB |
Output is correct |
56 |
Correct |
41 ms |
37668 KB |
Output is correct |
57 |
Correct |
52 ms |
36416 KB |
Output is correct |
58 |
Correct |
50 ms |
37336 KB |
Output is correct |
59 |
Correct |
54 ms |
37352 KB |
Output is correct |
60 |
Correct |
68 ms |
37288 KB |
Output is correct |
61 |
Correct |
58 ms |
37292 KB |
Output is correct |
62 |
Correct |
55 ms |
37288 KB |
Output is correct |
63 |
Correct |
55 ms |
37336 KB |
Output is correct |
64 |
Correct |
43 ms |
37856 KB |
Output is correct |
65 |
Correct |
43 ms |
37812 KB |
Output is correct |
66 |
Correct |
41 ms |
37700 KB |
Output is correct |
67 |
Correct |
41 ms |
37800 KB |
Output is correct |
68 |
Correct |
1008 ms |
37084 KB |
Output is correct |
69 |
Correct |
1272 ms |
37308 KB |
Output is correct |
70 |
Correct |
1195 ms |
37344 KB |
Output is correct |
71 |
Correct |
1090 ms |
37436 KB |
Output is correct |
72 |
Correct |
1229 ms |
37276 KB |
Output is correct |
73 |
Correct |
1320 ms |
37348 KB |
Output is correct |
74 |
Correct |
1069 ms |
37364 KB |
Output is correct |
75 |
Correct |
950 ms |
37804 KB |
Output is correct |
76 |
Correct |
1018 ms |
37952 KB |
Output is correct |
77 |
Correct |
1046 ms |
37760 KB |
Output is correct |
78 |
Correct |
1086 ms |
37696 KB |
Output is correct |
79 |
Correct |
966 ms |
37804 KB |
Output is correct |
80 |
Correct |
1075 ms |
37900 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 |
55 ms |
37292 KB |
Output is correct |
85 |
Correct |
61 ms |
37272 KB |
Output is correct |
86 |
Correct |
68 ms |
37296 KB |
Output is correct |
87 |
Correct |
42 ms |
37824 KB |
Output is correct |
88 |
Correct |
41 ms |
37792 KB |
Output is correct |
89 |
Correct |
61 ms |
37348 KB |
Output is correct |
90 |
Correct |
60 ms |
37296 KB |
Output is correct |
91 |
Correct |
66 ms |
37288 KB |
Output is correct |
92 |
Correct |
48 ms |
37800 KB |
Output is correct |
93 |
Correct |
43 ms |
37668 KB |
Output is correct |
94 |
Correct |
1 ms |
848 KB |
Output is correct |
95 |
Correct |
1 ms |
848 KB |
Output is correct |
96 |
Correct |
2 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 |
2 ms |
848 KB |
Output is correct |
103 |
Correct |
1 ms |
848 KB |
Output is correct |
104 |
Correct |
1140 ms |
34052 KB |
Output is correct |
105 |
Correct |
1187 ms |
37292 KB |
Output is correct |
106 |
Correct |
1214 ms |
37320 KB |
Output is correct |
107 |
Correct |
1302 ms |
37452 KB |
Output is correct |
108 |
Correct |
1145 ms |
37284 KB |
Output is correct |
109 |
Correct |
1234 ms |
37308 KB |
Output is correct |
110 |
Correct |
1250 ms |
37448 KB |
Output is correct |
111 |
Correct |
1053 ms |
37800 KB |
Output is correct |
112 |
Correct |
1041 ms |
37824 KB |
Output is correct |
113 |
Correct |
1054 ms |
37596 KB |
Output is correct |
114 |
Correct |
1073 ms |
37808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
609 ms |
21032 KB |
Output is correct |
2 |
Correct |
1279 ms |
37812 KB |
Output is correct |
3 |
Correct |
1366 ms |
37808 KB |
Output is correct |
4 |
Correct |
1046 ms |
37796 KB |
Output is correct |
5 |
Correct |
1018 ms |
37796 KB |
Output is correct |
6 |
Correct |
1018 ms |
37788 KB |
Output is correct |
7 |
Correct |
924 ms |
37788 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 |
1 ms |
464 KB |
Output is correct |
12 |
Correct |
2 ms |
848 KB |
Output is correct |
13 |
Correct |
1 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 |
1 ms |
848 KB |
Output is correct |
17 |
Correct |
2 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 |
0 ms |
336 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 |
848 KB |
Output is correct |
26 |
Correct |
1 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
848 KB |
Output is correct |
28 |
Correct |
2 ms |
848 KB |
Output is correct |
29 |
Correct |
1 ms |
848 KB |
Output is correct |
30 |
Correct |
2 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 |
928 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 |
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 |
30 ms |
22324 KB |
Output is correct |
47 |
Correct |
58 ms |
37332 KB |
Output is correct |
48 |
Correct |
53 ms |
37256 KB |
Output is correct |
49 |
Correct |
59 ms |
37280 KB |
Output is correct |
50 |
Correct |
54 ms |
37340 KB |
Output is correct |
51 |
Correct |
55 ms |
37352 KB |
Output is correct |
52 |
Correct |
68 ms |
37264 KB |
Output is correct |
53 |
Correct |
56 ms |
37808 KB |
Output is correct |
54 |
Correct |
48 ms |
37768 KB |
Output is correct |
55 |
Correct |
49 ms |
37688 KB |
Output is correct |
56 |
Correct |
42 ms |
37648 KB |
Output is correct |
57 |
Correct |
58 ms |
37284 KB |
Output is correct |
58 |
Correct |
69 ms |
37284 KB |
Output is correct |
59 |
Correct |
75 ms |
37288 KB |
Output is correct |
60 |
Correct |
41 ms |
37792 KB |
Output is correct |
61 |
Correct |
42 ms |
37772 KB |
Output is correct |
62 |
Correct |
50 ms |
37312 KB |
Output is correct |
63 |
Correct |
65 ms |
37340 KB |
Output is correct |
64 |
Correct |
67 ms |
37320 KB |
Output is correct |
65 |
Correct |
53 ms |
37788 KB |
Output is correct |
66 |
Correct |
41 ms |
37668 KB |
Output is correct |
67 |
Correct |
52 ms |
36416 KB |
Output is correct |
68 |
Correct |
50 ms |
37336 KB |
Output is correct |
69 |
Correct |
54 ms |
37352 KB |
Output is correct |
70 |
Correct |
68 ms |
37288 KB |
Output is correct |
71 |
Correct |
58 ms |
37292 KB |
Output is correct |
72 |
Correct |
55 ms |
37288 KB |
Output is correct |
73 |
Correct |
55 ms |
37336 KB |
Output is correct |
74 |
Correct |
43 ms |
37856 KB |
Output is correct |
75 |
Correct |
43 ms |
37812 KB |
Output is correct |
76 |
Correct |
41 ms |
37700 KB |
Output is correct |
77 |
Correct |
41 ms |
37800 KB |
Output is correct |
78 |
Correct |
1008 ms |
37084 KB |
Output is correct |
79 |
Correct |
1272 ms |
37308 KB |
Output is correct |
80 |
Correct |
1195 ms |
37344 KB |
Output is correct |
81 |
Correct |
1090 ms |
37436 KB |
Output is correct |
82 |
Correct |
1229 ms |
37276 KB |
Output is correct |
83 |
Correct |
1320 ms |
37348 KB |
Output is correct |
84 |
Correct |
1069 ms |
37364 KB |
Output is correct |
85 |
Correct |
950 ms |
37804 KB |
Output is correct |
86 |
Correct |
1018 ms |
37952 KB |
Output is correct |
87 |
Correct |
1046 ms |
37760 KB |
Output is correct |
88 |
Correct |
1086 ms |
37696 KB |
Output is correct |
89 |
Correct |
966 ms |
37804 KB |
Output is correct |
90 |
Correct |
1075 ms |
37900 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 |
55 ms |
37292 KB |
Output is correct |
95 |
Correct |
61 ms |
37272 KB |
Output is correct |
96 |
Correct |
68 ms |
37296 KB |
Output is correct |
97 |
Correct |
42 ms |
37824 KB |
Output is correct |
98 |
Correct |
41 ms |
37792 KB |
Output is correct |
99 |
Correct |
61 ms |
37348 KB |
Output is correct |
100 |
Correct |
60 ms |
37296 KB |
Output is correct |
101 |
Correct |
66 ms |
37288 KB |
Output is correct |
102 |
Correct |
48 ms |
37800 KB |
Output is correct |
103 |
Correct |
43 ms |
37668 KB |
Output is correct |
104 |
Correct |
1 ms |
848 KB |
Output is correct |
105 |
Correct |
1 ms |
848 KB |
Output is correct |
106 |
Correct |
2 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 |
2 ms |
848 KB |
Output is correct |
113 |
Correct |
1 ms |
848 KB |
Output is correct |
114 |
Correct |
302 ms |
8528 KB |
Output is correct |
115 |
Correct |
981 ms |
37268 KB |
Output is correct |
116 |
Correct |
1053 ms |
37288 KB |
Output is correct |
117 |
Correct |
1080 ms |
37264 KB |
Output is correct |
118 |
Correct |
1020 ms |
37292 KB |
Output is correct |
119 |
Correct |
1058 ms |
37316 KB |
Output is correct |
120 |
Correct |
1150 ms |
37328 KB |
Output is correct |
121 |
Correct |
1132 ms |
37852 KB |
Output is correct |
122 |
Correct |
756 ms |
37824 KB |
Output is correct |
123 |
Correct |
1105 ms |
37696 KB |
Output is correct |
124 |
Correct |
1160 ms |
37812 KB |
Output is correct |
125 |
Correct |
54 ms |
37264 KB |
Output is correct |
126 |
Correct |
58 ms |
37244 KB |
Output is correct |
127 |
Correct |
61 ms |
37288 KB |
Output is correct |
128 |
Correct |
43 ms |
37824 KB |
Output is correct |
129 |
Correct |
41 ms |
37648 KB |
Output is correct |
130 |
Correct |
51 ms |
36372 KB |
Output is correct |
131 |
Correct |
52 ms |
37340 KB |
Output is correct |
132 |
Correct |
54 ms |
37308 KB |
Output is correct |
133 |
Correct |
59 ms |
37344 KB |
Output is correct |
134 |
Correct |
65 ms |
37344 KB |
Output is correct |
135 |
Correct |
59 ms |
37296 KB |
Output is correct |
136 |
Correct |
55 ms |
37296 KB |
Output is correct |
137 |
Correct |
42 ms |
37800 KB |
Output is correct |
138 |
Correct |
41 ms |
37828 KB |
Output is correct |
139 |
Correct |
46 ms |
37676 KB |
Output is correct |
140 |
Correct |
51 ms |
37812 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 |
2 ms |
592 KB |
Output is correct |
147 |
Correct |
1 ms |
848 KB |
Output is correct |
148 |
Correct |
2 ms |
824 KB |
Output is correct |
149 |
Correct |
1 ms |
840 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 |
1 ms |
848 KB |
Output is correct |
156 |
Correct |
1 ms |
848 KB |
Output is correct |
157 |
Correct |
1140 ms |
34052 KB |
Output is correct |
158 |
Correct |
1187 ms |
37292 KB |
Output is correct |
159 |
Correct |
1214 ms |
37320 KB |
Output is correct |
160 |
Correct |
1302 ms |
37452 KB |
Output is correct |
161 |
Correct |
1145 ms |
37284 KB |
Output is correct |
162 |
Correct |
1234 ms |
37308 KB |
Output is correct |
163 |
Correct |
1250 ms |
37448 KB |
Output is correct |
164 |
Correct |
1053 ms |
37800 KB |
Output is correct |
165 |
Correct |
1041 ms |
37824 KB |
Output is correct |
166 |
Correct |
1054 ms |
37596 KB |
Output is correct |
167 |
Correct |
1073 ms |
37808 KB |
Output is correct |
168 |
Correct |
1 ms |
336 KB |
Output is correct |
169 |
Correct |
838 ms |
13756 KB |
Output is correct |
170 |
Correct |
1396 ms |
37320 KB |
Output is correct |
171 |
Correct |
1355 ms |
37356 KB |
Output is correct |
172 |
Correct |
1356 ms |
37296 KB |
Output is correct |
173 |
Correct |
1297 ms |
37308 KB |
Output is correct |
174 |
Correct |
1307 ms |
37320 KB |
Output is correct |
175 |
Correct |
1392 ms |
37284 KB |
Output is correct |
176 |
Correct |
932 ms |
37788 KB |
Output is correct |
177 |
Correct |
952 ms |
37820 KB |
Output is correct |
178 |
Correct |
1012 ms |
37824 KB |
Output is correct |
179 |
Correct |
853 ms |
37656 KB |
Output is correct |