// correct/solution-log2n.cpp
#ifndef ATCODER_INTERNAL_BITOP_HPP
#define ATCODER_INTERNAL_BITOP_HPP 1
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigned int)(n)) x++;
return x;
}
// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
constexpr int bsf_constexpr(unsigned int n) {
int x = 0;
while (!(n & (1 << x))) x++;
return x;
}
// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
int bsf(unsigned int n) {
#ifdef _MSC_VER
unsigned long index;
_BitScanForward(&index, n);
return index;
#else
return __builtin_ctz(n);
#endif
}
} // namespace internal
} // namespace atcoder
#endif // ATCODER_INTERNAL_BITOP_HPP
#ifndef ATCODER_SEGTREE_HPP
#define ATCODER_SEGTREE_HPP 1
#include <algorithm>
#include <cassert>
#include <vector>
namespace atcoder {
template <class S, S (*op)(S, S), S (*e)()> struct segtree {
public:
segtree() : segtree(0) {}
explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}
explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {
log = internal::ceil_pow2(_n);
size = 1 << log;
d = std::vector<S>(2 * size, e());
for (int i = 0; i < _n; i++) d[size + i] = v[i];
for (int i = size - 1; i >= 1; i--) {
update(i);
}
}
void set(int p, S x) {
assert(0 <= p && p < _n);
p += size;
d[p] = x;
for (int i = 1; i <= log; i++) update(p >> i);
}
S get(int p) const {
assert(0 <= p && p < _n);
return d[p + size];
}
S prod(int l, int r) const {
assert(0 <= l && l <= r && r <= _n);
S sml = e(), smr = e();
l += size;
r += size;
while (l < r) {
if (l & 1) sml = op(sml, d[l++]);
if (r & 1) smr = op(d[--r], smr);
l >>= 1;
r >>= 1;
}
return op(sml, smr);
}
S all_prod() const { return d[1]; }
template <bool (*f)(S)> int max_right(int l) const {
return max_right(l, [](S x) { return f(x); });
}
template <class F> int max_right(int l, F f) const {
assert(0 <= l && l <= _n);
assert(f(e()));
if (l == _n) return _n;
l += size;
S sm = e();
do {
while (l % 2 == 0) l >>= 1;
if (!f(op(sm, d[l]))) {
while (l < size) {
l = (2 * l);
if (f(op(sm, d[l]))) {
sm = op(sm, d[l]);
l++;
}
}
return l - size;
}
sm = op(sm, d[l]);
l++;
} while ((l & -l) != l);
return _n;
}
template <bool (*f)(S)> int min_left(int r) const {
return min_left(r, [](S x) { return f(x); });
}
template <class F> int min_left(int r, F f) const {
assert(0 <= r && r <= _n);
assert(f(e()));
if (r == 0) return 0;
r += size;
S sm = e();
do {
r--;
while (r > 1 && (r % 2)) r >>= 1;
if (!f(op(d[r], sm))) {
while (r < size) {
r = (2 * r + 1);
if (f(op(d[r], sm))) {
sm = op(d[r], sm);
r--;
}
}
return r + 1 - size;
}
sm = op(d[r], sm);
} while ((r & -r) != r);
return 0;
}
private:
int _n, size, log;
std::vector<S> d;
void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};
} // namespace atcoder
#endif // ATCODER_SEGTREE_HPP
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
struct Node {
int max;
int min;
int max_right_min_left;
int max_left_min_right;
};
typedef optional<Node> OptionalNode;
OptionalNode Empty() {
return {};
}
OptionalNode Merge(OptionalNode l, OptionalNode r) {
if (!l.has_value()) {
return r;
}
if (!r.has_value()) {
return l;
}
return (Node) {
max(l.value().max, r.value().max),
min(l.value().min, r.value().min),
max(max(l.value().max_right_min_left, r.value().max_right_min_left),
r.value().max - l.value().min),
max(max(l.value().max_left_min_right, r.value().max_left_min_right),
l.value().max - r.value().min)
};
}
typedef atcoder::segtree<OptionalNode, Merge, Empty> Segtree;
int N;
vector<int> H;
Segtree st;
vector<int> maxD;
vector<int> maxDs;
map<int, int> ixMaxD;
int szMaxD;
struct PersistentNode {
PersistentNode(int _val, PersistentNode* _l, PersistentNode* _r)
: val(_val), l(_l), r(_r) {}
int val;
PersistentNode* l;
PersistentNode* r;
};
vector<PersistentNode*> persistent_st;
PersistentNode* empty(int L, int R) {
if (L == R) {
return new PersistentNode(0, NULL, NULL);
}
int M = (L + R) >> 1;
return new PersistentNode(0, empty(L, M), empty(M + 1, R));
}
PersistentNode* update(PersistentNode* node, int L, int R, int pos, int val) {
if (pos < L || pos > R) {
return node;
}
if (L == R) {
return new PersistentNode(node->val + val, NULL, NULL);
}
int M = (L + R) >> 1;
return new PersistentNode(
node->val + val,
update(node->l, L, M, pos, val),
update(node->r, M + 1, R, pos, val));
}
int query(
PersistentNode* add, PersistentNode* sub, int L, int R, int x, int y) {
if (x <= L && R <= y) {
return add->val - sub->val;
}
if (y < L || R < x) {
return 0;
}
int M = (L + R) >> 1;
return
query(add->l, sub->l, L, M, x, y) + query(add->r, sub->r, M + 1, R, x, y);
}
void init(int _N, std::vector<int> _H) {
N = _N;
H = _H;
st = Segtree(N);
for (int i = 0; i < N; ++i) {
st.set(i, (Node) {H[i], H[i], INT_MIN, INT_MIN});
}
for (int i = 0; i < N; ++i) {
int lower_height_left = st.min_left(
i, [&] (OptionalNode node) {
return !node.has_value() || node.value().min >= H[i];
}) - 1;
int lower_height_right = st.max_right(
i + 1, [&] (OptionalNode node) {
return !node.has_value() || node.value().min >= H[i];
});
int ret = INT_MAX;
if (lower_height_left >= 0) {
ret = min(ret, st.prod(lower_height_left + 1, i + 1).value().max - H[i]);
}
if (lower_height_right < N) {
ret = min(ret, st.prod(i, lower_height_right).value().max - H[i]);
}
maxD.push_back(ret);
maxDs.push_back(ret);
}
sort(maxDs.begin(), maxDs.end());
maxDs.erase(unique(maxDs.begin(), maxDs.end()), maxDs.end());
for (int i = 0; i < static_cast<int>(maxDs.size()); ++i) {
ixMaxD[maxDs[i]] = i;
}
szMaxD = maxDs.size();
persistent_st.push_back(empty(0, szMaxD - 1));
for (int i = 0; i < N; ++i) {
persistent_st.push_back(
update(persistent_st[i], 0, szMaxD - 1, ixMaxD[maxD[i]], 1));
}
}
int max_towers(int L, int R, int D) {
int ixD = lower_bound(maxDs.begin(), maxDs.end(), D) - maxDs.begin();
int answer = query(
persistent_st[R + 1], persistent_st[L], 0, szMaxD - 1, ixD, szMaxD - 1);
if (answer == 0) {
answer = 1;
int minH = st.prod(L, R + 1).value().min;
int minH_index = st.max_right(
L, [&] (OptionalNode node) {
return !node.has_value() || node.value().min > minH;
});
OptionalNode node_left = st.prod(L, minH_index);
if (node_left.has_value() && node_left.value().max_right_min_left >= D) {
++answer;
}
OptionalNode node_right = st.prod(minH_index + 1, R + 1);
if (node_right.has_value() && node_right.value().max_left_min_right >= D) {
++answer;
}
assert(answer <= 2);
return answer;
}
int leftmost_answer = L, rightmost_answer = R;
{
int lo = L;
int hi = R;
while (lo <= hi) {
int mid = (lo + hi) >> 1;
if (query(persistent_st[mid + 1], persistent_st[L],
0, szMaxD - 1, ixD, szMaxD - 1) > 0) {
leftmost_answer = mid;
hi = mid - 1;
} else {
lo = mid + 1;
}
}
}
{
int lo = L;
int hi = R;
while (lo <= hi) {
int mid = (lo + hi) >> 1;
if (query(persistent_st[R + 1], persistent_st[mid],
0, szMaxD - 1, ixD, szMaxD - 1) > 0) {
rightmost_answer = mid;
lo = mid + 1;
} else {
hi = mid - 1;
}
}
}
OptionalNode node_left = st.prod(L, leftmost_answer);
if (node_left.has_value() && node_left.value().max_right_min_left >= D) {
++answer;
}
OptionalNode node_right = st.prod(rightmost_answer + 1, R + 1);
if (node_right.has_value() && node_right.value().max_left_min_right >= D) {
++answer;
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
638 ms |
10016 KB |
Output is correct |
2 |
Correct |
1459 ms |
17684 KB |
Output is correct |
3 |
Correct |
1477 ms |
17660 KB |
Output is correct |
4 |
Correct |
1243 ms |
14464 KB |
Output is correct |
5 |
Correct |
1369 ms |
14536 KB |
Output is correct |
6 |
Correct |
1559 ms |
17576 KB |
Output is correct |
7 |
Correct |
1355 ms |
14440 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
3 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
4 ms |
1184 KB |
Output is correct |
3 |
Correct |
3 ms |
1116 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |
5 |
Correct |
3 ms |
1116 KB |
Output is correct |
6 |
Correct |
3 ms |
1244 KB |
Output is correct |
7 |
Correct |
5 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
476 KB |
Output is correct |
9 |
Correct |
2 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
592 KB |
Output is correct |
14 |
Correct |
4 ms |
464 KB |
Output is correct |
15 |
Correct |
2 ms |
1104 KB |
Output is correct |
16 |
Correct |
6 ms |
1216 KB |
Output is correct |
17 |
Correct |
7 ms |
1104 KB |
Output is correct |
18 |
Correct |
3 ms |
484 KB |
Output is correct |
19 |
Correct |
3 ms |
560 KB |
Output is correct |
20 |
Correct |
4 ms |
1104 KB |
Output is correct |
21 |
Correct |
7 ms |
1232 KB |
Output is correct |
22 |
Correct |
3 ms |
1104 KB |
Output is correct |
23 |
Correct |
2 ms |
464 KB |
Output is correct |
24 |
Correct |
3 ms |
604 KB |
Output is correct |
25 |
Correct |
2 ms |
604 KB |
Output is correct |
26 |
Correct |
4 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
1112 KB |
Output is correct |
28 |
Correct |
4 ms |
1244 KB |
Output is correct |
29 |
Correct |
3 ms |
1116 KB |
Output is correct |
30 |
Correct |
4 ms |
1280 KB |
Output is correct |
31 |
Correct |
4 ms |
1116 KB |
Output is correct |
32 |
Correct |
2 ms |
472 KB |
Output is correct |
33 |
Correct |
2 ms |
472 KB |
Output is correct |
34 |
Correct |
2 ms |
600 KB |
Output is correct |
35 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
4 ms |
1184 KB |
Output is correct |
3 |
Correct |
3 ms |
1116 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |
5 |
Correct |
3 ms |
1116 KB |
Output is correct |
6 |
Correct |
3 ms |
1244 KB |
Output is correct |
7 |
Correct |
5 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
476 KB |
Output is correct |
9 |
Correct |
2 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
592 KB |
Output is correct |
14 |
Correct |
4 ms |
464 KB |
Output is correct |
15 |
Correct |
2 ms |
1104 KB |
Output is correct |
16 |
Correct |
6 ms |
1216 KB |
Output is correct |
17 |
Correct |
7 ms |
1104 KB |
Output is correct |
18 |
Correct |
3 ms |
484 KB |
Output is correct |
19 |
Correct |
3 ms |
560 KB |
Output is correct |
20 |
Correct |
4 ms |
1104 KB |
Output is correct |
21 |
Correct |
7 ms |
1232 KB |
Output is correct |
22 |
Correct |
3 ms |
1104 KB |
Output is correct |
23 |
Correct |
2 ms |
464 KB |
Output is correct |
24 |
Correct |
3 ms |
604 KB |
Output is correct |
25 |
Correct |
2 ms |
604 KB |
Output is correct |
26 |
Correct |
4 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
1112 KB |
Output is correct |
28 |
Correct |
4 ms |
1244 KB |
Output is correct |
29 |
Correct |
3 ms |
1116 KB |
Output is correct |
30 |
Correct |
4 ms |
1280 KB |
Output is correct |
31 |
Correct |
4 ms |
1116 KB |
Output is correct |
32 |
Correct |
2 ms |
472 KB |
Output is correct |
33 |
Correct |
2 ms |
472 KB |
Output is correct |
34 |
Correct |
2 ms |
600 KB |
Output is correct |
35 |
Correct |
3 ms |
592 KB |
Output is correct |
36 |
Correct |
117 ms |
39192 KB |
Output is correct |
37 |
Correct |
221 ms |
64104 KB |
Output is correct |
38 |
Correct |
215 ms |
64100 KB |
Output is correct |
39 |
Correct |
276 ms |
66528 KB |
Output is correct |
40 |
Correct |
253 ms |
66480 KB |
Output is correct |
41 |
Correct |
228 ms |
66524 KB |
Output is correct |
42 |
Correct |
241 ms |
66452 KB |
Output is correct |
43 |
Correct |
81 ms |
14504 KB |
Output is correct |
44 |
Correct |
100 ms |
14496 KB |
Output is correct |
45 |
Correct |
114 ms |
20824 KB |
Output is correct |
46 |
Correct |
139 ms |
20748 KB |
Output is correct |
47 |
Correct |
220 ms |
64288 KB |
Output is correct |
48 |
Correct |
200 ms |
66528 KB |
Output is correct |
49 |
Correct |
262 ms |
66520 KB |
Output is correct |
50 |
Correct |
90 ms |
14464 KB |
Output is correct |
51 |
Correct |
94 ms |
20808 KB |
Output is correct |
52 |
Correct |
240 ms |
64160 KB |
Output is correct |
53 |
Correct |
388 ms |
66476 KB |
Output is correct |
54 |
Correct |
259 ms |
66468 KB |
Output is correct |
55 |
Correct |
77 ms |
14560 KB |
Output is correct |
56 |
Correct |
119 ms |
20808 KB |
Output is correct |
57 |
Correct |
173 ms |
60024 KB |
Output is correct |
58 |
Correct |
237 ms |
64184 KB |
Output is correct |
59 |
Correct |
226 ms |
64132 KB |
Output is correct |
60 |
Correct |
209 ms |
66452 KB |
Output is correct |
61 |
Correct |
207 ms |
66404 KB |
Output is correct |
62 |
Correct |
277 ms |
66424 KB |
Output is correct |
63 |
Correct |
204 ms |
66448 KB |
Output is correct |
64 |
Correct |
111 ms |
14516 KB |
Output is correct |
65 |
Correct |
96 ms |
14544 KB |
Output is correct |
66 |
Correct |
136 ms |
20820 KB |
Output is correct |
67 |
Correct |
96 ms |
20740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2173 ms |
63700 KB |
Output is correct |
2 |
Correct |
3183 ms |
64084 KB |
Output is correct |
3 |
Correct |
3094 ms |
64132 KB |
Output is correct |
4 |
Correct |
2768 ms |
66484 KB |
Output is correct |
5 |
Correct |
3147 ms |
66412 KB |
Output is correct |
6 |
Correct |
2949 ms |
66428 KB |
Output is correct |
7 |
Correct |
3052 ms |
66404 KB |
Output is correct |
8 |
Correct |
1231 ms |
14492 KB |
Output is correct |
9 |
Correct |
1417 ms |
14512 KB |
Output is correct |
10 |
Correct |
1557 ms |
20764 KB |
Output is correct |
11 |
Correct |
1688 ms |
20800 KB |
Output is correct |
12 |
Correct |
1180 ms |
17584 KB |
Output is correct |
13 |
Correct |
1242 ms |
14500 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
4 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
464 KB |
Output is correct |
17 |
Correct |
178 ms |
64072 KB |
Output is correct |
18 |
Correct |
248 ms |
66444 KB |
Output is correct |
19 |
Correct |
199 ms |
66408 KB |
Output is correct |
20 |
Correct |
86 ms |
14556 KB |
Output is correct |
21 |
Correct |
100 ms |
20808 KB |
Output is correct |
22 |
Correct |
229 ms |
64144 KB |
Output is correct |
23 |
Correct |
245 ms |
66544 KB |
Output is correct |
24 |
Correct |
259 ms |
66520 KB |
Output is correct |
25 |
Correct |
86 ms |
14548 KB |
Output is correct |
26 |
Correct |
131 ms |
20756 KB |
Output is correct |
27 |
Correct |
4 ms |
1152 KB |
Output is correct |
28 |
Correct |
4 ms |
1104 KB |
Output is correct |
29 |
Correct |
4 ms |
1284 KB |
Output is correct |
30 |
Correct |
2 ms |
464 KB |
Output is correct |
31 |
Correct |
3 ms |
592 KB |
Output is correct |
32 |
Correct |
4 ms |
1132 KB |
Output is correct |
33 |
Correct |
4 ms |
1152 KB |
Output is correct |
34 |
Correct |
3 ms |
1104 KB |
Output is correct |
35 |
Correct |
2 ms |
472 KB |
Output is correct |
36 |
Correct |
2 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
583 ms |
13596 KB |
Output is correct |
2 |
Correct |
2239 ms |
64148 KB |
Output is correct |
3 |
Correct |
2461 ms |
64132 KB |
Output is correct |
4 |
Correct |
2238 ms |
66580 KB |
Output is correct |
5 |
Correct |
2299 ms |
66412 KB |
Output is correct |
6 |
Correct |
2424 ms |
66516 KB |
Output is correct |
7 |
Correct |
2201 ms |
66444 KB |
Output is correct |
8 |
Correct |
1124 ms |
14536 KB |
Output is correct |
9 |
Correct |
1216 ms |
14476 KB |
Output is correct |
10 |
Correct |
1192 ms |
20768 KB |
Output is correct |
11 |
Correct |
1211 ms |
20744 KB |
Output is correct |
12 |
Correct |
256 ms |
64172 KB |
Output is correct |
13 |
Correct |
283 ms |
66420 KB |
Output is correct |
14 |
Correct |
272 ms |
66408 KB |
Output is correct |
15 |
Correct |
93 ms |
14464 KB |
Output is correct |
16 |
Correct |
140 ms |
20748 KB |
Output is correct |
17 |
Correct |
204 ms |
60016 KB |
Output is correct |
18 |
Correct |
220 ms |
64092 KB |
Output is correct |
19 |
Correct |
242 ms |
64124 KB |
Output is correct |
20 |
Correct |
236 ms |
66452 KB |
Output is correct |
21 |
Correct |
238 ms |
66496 KB |
Output is correct |
22 |
Correct |
223 ms |
66504 KB |
Output is correct |
23 |
Correct |
274 ms |
66400 KB |
Output is correct |
24 |
Correct |
102 ms |
14480 KB |
Output is correct |
25 |
Correct |
102 ms |
14464 KB |
Output is correct |
26 |
Correct |
130 ms |
20756 KB |
Output is correct |
27 |
Correct |
101 ms |
20820 KB |
Output is correct |
28 |
Correct |
4 ms |
1104 KB |
Output is correct |
29 |
Correct |
4 ms |
1104 KB |
Output is correct |
30 |
Correct |
4 ms |
1104 KB |
Output is correct |
31 |
Correct |
2 ms |
464 KB |
Output is correct |
32 |
Correct |
2 ms |
592 KB |
Output is correct |
33 |
Correct |
2 ms |
592 KB |
Output is correct |
34 |
Correct |
4 ms |
1152 KB |
Output is correct |
35 |
Correct |
4 ms |
1104 KB |
Output is correct |
36 |
Correct |
3 ms |
1104 KB |
Output is correct |
37 |
Correct |
4 ms |
1280 KB |
Output is correct |
38 |
Correct |
4 ms |
1280 KB |
Output is correct |
39 |
Correct |
4 ms |
1232 KB |
Output is correct |
40 |
Correct |
3 ms |
464 KB |
Output is correct |
41 |
Correct |
3 ms |
464 KB |
Output is correct |
42 |
Correct |
3 ms |
592 KB |
Output is correct |
43 |
Correct |
3 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
464 KB |
Output is correct |
2 |
Correct |
4 ms |
1184 KB |
Output is correct |
3 |
Correct |
3 ms |
1116 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |
5 |
Correct |
3 ms |
1116 KB |
Output is correct |
6 |
Correct |
3 ms |
1244 KB |
Output is correct |
7 |
Correct |
5 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
476 KB |
Output is correct |
9 |
Correct |
2 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
596 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
592 KB |
Output is correct |
14 |
Correct |
4 ms |
464 KB |
Output is correct |
15 |
Correct |
2 ms |
1104 KB |
Output is correct |
16 |
Correct |
6 ms |
1216 KB |
Output is correct |
17 |
Correct |
7 ms |
1104 KB |
Output is correct |
18 |
Correct |
3 ms |
484 KB |
Output is correct |
19 |
Correct |
3 ms |
560 KB |
Output is correct |
20 |
Correct |
4 ms |
1104 KB |
Output is correct |
21 |
Correct |
7 ms |
1232 KB |
Output is correct |
22 |
Correct |
3 ms |
1104 KB |
Output is correct |
23 |
Correct |
2 ms |
464 KB |
Output is correct |
24 |
Correct |
3 ms |
604 KB |
Output is correct |
25 |
Correct |
2 ms |
604 KB |
Output is correct |
26 |
Correct |
4 ms |
1116 KB |
Output is correct |
27 |
Correct |
4 ms |
1112 KB |
Output is correct |
28 |
Correct |
4 ms |
1244 KB |
Output is correct |
29 |
Correct |
3 ms |
1116 KB |
Output is correct |
30 |
Correct |
4 ms |
1280 KB |
Output is correct |
31 |
Correct |
4 ms |
1116 KB |
Output is correct |
32 |
Correct |
2 ms |
472 KB |
Output is correct |
33 |
Correct |
2 ms |
472 KB |
Output is correct |
34 |
Correct |
2 ms |
600 KB |
Output is correct |
35 |
Correct |
3 ms |
592 KB |
Output is correct |
36 |
Correct |
117 ms |
39192 KB |
Output is correct |
37 |
Correct |
221 ms |
64104 KB |
Output is correct |
38 |
Correct |
215 ms |
64100 KB |
Output is correct |
39 |
Correct |
276 ms |
66528 KB |
Output is correct |
40 |
Correct |
253 ms |
66480 KB |
Output is correct |
41 |
Correct |
228 ms |
66524 KB |
Output is correct |
42 |
Correct |
241 ms |
66452 KB |
Output is correct |
43 |
Correct |
81 ms |
14504 KB |
Output is correct |
44 |
Correct |
100 ms |
14496 KB |
Output is correct |
45 |
Correct |
114 ms |
20824 KB |
Output is correct |
46 |
Correct |
139 ms |
20748 KB |
Output is correct |
47 |
Correct |
220 ms |
64288 KB |
Output is correct |
48 |
Correct |
200 ms |
66528 KB |
Output is correct |
49 |
Correct |
262 ms |
66520 KB |
Output is correct |
50 |
Correct |
90 ms |
14464 KB |
Output is correct |
51 |
Correct |
94 ms |
20808 KB |
Output is correct |
52 |
Correct |
240 ms |
64160 KB |
Output is correct |
53 |
Correct |
388 ms |
66476 KB |
Output is correct |
54 |
Correct |
259 ms |
66468 KB |
Output is correct |
55 |
Correct |
77 ms |
14560 KB |
Output is correct |
56 |
Correct |
119 ms |
20808 KB |
Output is correct |
57 |
Correct |
173 ms |
60024 KB |
Output is correct |
58 |
Correct |
237 ms |
64184 KB |
Output is correct |
59 |
Correct |
226 ms |
64132 KB |
Output is correct |
60 |
Correct |
209 ms |
66452 KB |
Output is correct |
61 |
Correct |
207 ms |
66404 KB |
Output is correct |
62 |
Correct |
277 ms |
66424 KB |
Output is correct |
63 |
Correct |
204 ms |
66448 KB |
Output is correct |
64 |
Correct |
111 ms |
14516 KB |
Output is correct |
65 |
Correct |
96 ms |
14544 KB |
Output is correct |
66 |
Correct |
136 ms |
20820 KB |
Output is correct |
67 |
Correct |
96 ms |
20740 KB |
Output is correct |
68 |
Correct |
2173 ms |
63700 KB |
Output is correct |
69 |
Correct |
3183 ms |
64084 KB |
Output is correct |
70 |
Correct |
3094 ms |
64132 KB |
Output is correct |
71 |
Correct |
2768 ms |
66484 KB |
Output is correct |
72 |
Correct |
3147 ms |
66412 KB |
Output is correct |
73 |
Correct |
2949 ms |
66428 KB |
Output is correct |
74 |
Correct |
3052 ms |
66404 KB |
Output is correct |
75 |
Correct |
1231 ms |
14492 KB |
Output is correct |
76 |
Correct |
1417 ms |
14512 KB |
Output is correct |
77 |
Correct |
1557 ms |
20764 KB |
Output is correct |
78 |
Correct |
1688 ms |
20800 KB |
Output is correct |
79 |
Correct |
1180 ms |
17584 KB |
Output is correct |
80 |
Correct |
1242 ms |
14500 KB |
Output is correct |
81 |
Correct |
1 ms |
208 KB |
Output is correct |
82 |
Correct |
4 ms |
592 KB |
Output is correct |
83 |
Correct |
2 ms |
464 KB |
Output is correct |
84 |
Correct |
178 ms |
64072 KB |
Output is correct |
85 |
Correct |
248 ms |
66444 KB |
Output is correct |
86 |
Correct |
199 ms |
66408 KB |
Output is correct |
87 |
Correct |
86 ms |
14556 KB |
Output is correct |
88 |
Correct |
100 ms |
20808 KB |
Output is correct |
89 |
Correct |
229 ms |
64144 KB |
Output is correct |
90 |
Correct |
245 ms |
66544 KB |
Output is correct |
91 |
Correct |
259 ms |
66520 KB |
Output is correct |
92 |
Correct |
86 ms |
14548 KB |
Output is correct |
93 |
Correct |
131 ms |
20756 KB |
Output is correct |
94 |
Correct |
4 ms |
1152 KB |
Output is correct |
95 |
Correct |
4 ms |
1104 KB |
Output is correct |
96 |
Correct |
4 ms |
1284 KB |
Output is correct |
97 |
Correct |
2 ms |
464 KB |
Output is correct |
98 |
Correct |
3 ms |
592 KB |
Output is correct |
99 |
Correct |
4 ms |
1132 KB |
Output is correct |
100 |
Correct |
4 ms |
1152 KB |
Output is correct |
101 |
Correct |
3 ms |
1104 KB |
Output is correct |
102 |
Correct |
2 ms |
472 KB |
Output is correct |
103 |
Correct |
2 ms |
592 KB |
Output is correct |
104 |
Correct |
2129 ms |
55640 KB |
Output is correct |
105 |
Correct |
2603 ms |
64100 KB |
Output is correct |
106 |
Correct |
2321 ms |
64136 KB |
Output is correct |
107 |
Correct |
2536 ms |
66480 KB |
Output is correct |
108 |
Correct |
2605 ms |
66540 KB |
Output is correct |
109 |
Correct |
2655 ms |
66488 KB |
Output is correct |
110 |
Correct |
2639 ms |
66520 KB |
Output is correct |
111 |
Correct |
1230 ms |
14536 KB |
Output is correct |
112 |
Correct |
1363 ms |
14476 KB |
Output is correct |
113 |
Correct |
1341 ms |
20736 KB |
Output is correct |
114 |
Correct |
1346 ms |
20724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
638 ms |
10016 KB |
Output is correct |
2 |
Correct |
1459 ms |
17684 KB |
Output is correct |
3 |
Correct |
1477 ms |
17660 KB |
Output is correct |
4 |
Correct |
1243 ms |
14464 KB |
Output is correct |
5 |
Correct |
1369 ms |
14536 KB |
Output is correct |
6 |
Correct |
1559 ms |
17576 KB |
Output is correct |
7 |
Correct |
1355 ms |
14440 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
3 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
476 KB |
Output is correct |
11 |
Correct |
2 ms |
464 KB |
Output is correct |
12 |
Correct |
4 ms |
1184 KB |
Output is correct |
13 |
Correct |
3 ms |
1116 KB |
Output is correct |
14 |
Correct |
4 ms |
1116 KB |
Output is correct |
15 |
Correct |
3 ms |
1116 KB |
Output is correct |
16 |
Correct |
3 ms |
1244 KB |
Output is correct |
17 |
Correct |
5 ms |
1116 KB |
Output is correct |
18 |
Correct |
3 ms |
476 KB |
Output is correct |
19 |
Correct |
2 ms |
492 KB |
Output is correct |
20 |
Correct |
3 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
596 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
3 ms |
592 KB |
Output is correct |
24 |
Correct |
4 ms |
464 KB |
Output is correct |
25 |
Correct |
2 ms |
1104 KB |
Output is correct |
26 |
Correct |
6 ms |
1216 KB |
Output is correct |
27 |
Correct |
7 ms |
1104 KB |
Output is correct |
28 |
Correct |
3 ms |
484 KB |
Output is correct |
29 |
Correct |
3 ms |
560 KB |
Output is correct |
30 |
Correct |
4 ms |
1104 KB |
Output is correct |
31 |
Correct |
7 ms |
1232 KB |
Output is correct |
32 |
Correct |
3 ms |
1104 KB |
Output is correct |
33 |
Correct |
2 ms |
464 KB |
Output is correct |
34 |
Correct |
3 ms |
604 KB |
Output is correct |
35 |
Correct |
2 ms |
604 KB |
Output is correct |
36 |
Correct |
4 ms |
1116 KB |
Output is correct |
37 |
Correct |
4 ms |
1112 KB |
Output is correct |
38 |
Correct |
4 ms |
1244 KB |
Output is correct |
39 |
Correct |
3 ms |
1116 KB |
Output is correct |
40 |
Correct |
4 ms |
1280 KB |
Output is correct |
41 |
Correct |
4 ms |
1116 KB |
Output is correct |
42 |
Correct |
2 ms |
472 KB |
Output is correct |
43 |
Correct |
2 ms |
472 KB |
Output is correct |
44 |
Correct |
2 ms |
600 KB |
Output is correct |
45 |
Correct |
3 ms |
592 KB |
Output is correct |
46 |
Correct |
117 ms |
39192 KB |
Output is correct |
47 |
Correct |
221 ms |
64104 KB |
Output is correct |
48 |
Correct |
215 ms |
64100 KB |
Output is correct |
49 |
Correct |
276 ms |
66528 KB |
Output is correct |
50 |
Correct |
253 ms |
66480 KB |
Output is correct |
51 |
Correct |
228 ms |
66524 KB |
Output is correct |
52 |
Correct |
241 ms |
66452 KB |
Output is correct |
53 |
Correct |
81 ms |
14504 KB |
Output is correct |
54 |
Correct |
100 ms |
14496 KB |
Output is correct |
55 |
Correct |
114 ms |
20824 KB |
Output is correct |
56 |
Correct |
139 ms |
20748 KB |
Output is correct |
57 |
Correct |
220 ms |
64288 KB |
Output is correct |
58 |
Correct |
200 ms |
66528 KB |
Output is correct |
59 |
Correct |
262 ms |
66520 KB |
Output is correct |
60 |
Correct |
90 ms |
14464 KB |
Output is correct |
61 |
Correct |
94 ms |
20808 KB |
Output is correct |
62 |
Correct |
240 ms |
64160 KB |
Output is correct |
63 |
Correct |
388 ms |
66476 KB |
Output is correct |
64 |
Correct |
259 ms |
66468 KB |
Output is correct |
65 |
Correct |
77 ms |
14560 KB |
Output is correct |
66 |
Correct |
119 ms |
20808 KB |
Output is correct |
67 |
Correct |
173 ms |
60024 KB |
Output is correct |
68 |
Correct |
237 ms |
64184 KB |
Output is correct |
69 |
Correct |
226 ms |
64132 KB |
Output is correct |
70 |
Correct |
209 ms |
66452 KB |
Output is correct |
71 |
Correct |
207 ms |
66404 KB |
Output is correct |
72 |
Correct |
277 ms |
66424 KB |
Output is correct |
73 |
Correct |
204 ms |
66448 KB |
Output is correct |
74 |
Correct |
111 ms |
14516 KB |
Output is correct |
75 |
Correct |
96 ms |
14544 KB |
Output is correct |
76 |
Correct |
136 ms |
20820 KB |
Output is correct |
77 |
Correct |
96 ms |
20740 KB |
Output is correct |
78 |
Correct |
2173 ms |
63700 KB |
Output is correct |
79 |
Correct |
3183 ms |
64084 KB |
Output is correct |
80 |
Correct |
3094 ms |
64132 KB |
Output is correct |
81 |
Correct |
2768 ms |
66484 KB |
Output is correct |
82 |
Correct |
3147 ms |
66412 KB |
Output is correct |
83 |
Correct |
2949 ms |
66428 KB |
Output is correct |
84 |
Correct |
3052 ms |
66404 KB |
Output is correct |
85 |
Correct |
1231 ms |
14492 KB |
Output is correct |
86 |
Correct |
1417 ms |
14512 KB |
Output is correct |
87 |
Correct |
1557 ms |
20764 KB |
Output is correct |
88 |
Correct |
1688 ms |
20800 KB |
Output is correct |
89 |
Correct |
1180 ms |
17584 KB |
Output is correct |
90 |
Correct |
1242 ms |
14500 KB |
Output is correct |
91 |
Correct |
1 ms |
208 KB |
Output is correct |
92 |
Correct |
4 ms |
592 KB |
Output is correct |
93 |
Correct |
2 ms |
464 KB |
Output is correct |
94 |
Correct |
178 ms |
64072 KB |
Output is correct |
95 |
Correct |
248 ms |
66444 KB |
Output is correct |
96 |
Correct |
199 ms |
66408 KB |
Output is correct |
97 |
Correct |
86 ms |
14556 KB |
Output is correct |
98 |
Correct |
100 ms |
20808 KB |
Output is correct |
99 |
Correct |
229 ms |
64144 KB |
Output is correct |
100 |
Correct |
245 ms |
66544 KB |
Output is correct |
101 |
Correct |
259 ms |
66520 KB |
Output is correct |
102 |
Correct |
86 ms |
14548 KB |
Output is correct |
103 |
Correct |
131 ms |
20756 KB |
Output is correct |
104 |
Correct |
4 ms |
1152 KB |
Output is correct |
105 |
Correct |
4 ms |
1104 KB |
Output is correct |
106 |
Correct |
4 ms |
1284 KB |
Output is correct |
107 |
Correct |
2 ms |
464 KB |
Output is correct |
108 |
Correct |
3 ms |
592 KB |
Output is correct |
109 |
Correct |
4 ms |
1132 KB |
Output is correct |
110 |
Correct |
4 ms |
1152 KB |
Output is correct |
111 |
Correct |
3 ms |
1104 KB |
Output is correct |
112 |
Correct |
2 ms |
472 KB |
Output is correct |
113 |
Correct |
2 ms |
592 KB |
Output is correct |
114 |
Correct |
583 ms |
13596 KB |
Output is correct |
115 |
Correct |
2239 ms |
64148 KB |
Output is correct |
116 |
Correct |
2461 ms |
64132 KB |
Output is correct |
117 |
Correct |
2238 ms |
66580 KB |
Output is correct |
118 |
Correct |
2299 ms |
66412 KB |
Output is correct |
119 |
Correct |
2424 ms |
66516 KB |
Output is correct |
120 |
Correct |
2201 ms |
66444 KB |
Output is correct |
121 |
Correct |
1124 ms |
14536 KB |
Output is correct |
122 |
Correct |
1216 ms |
14476 KB |
Output is correct |
123 |
Correct |
1192 ms |
20768 KB |
Output is correct |
124 |
Correct |
1211 ms |
20744 KB |
Output is correct |
125 |
Correct |
256 ms |
64172 KB |
Output is correct |
126 |
Correct |
283 ms |
66420 KB |
Output is correct |
127 |
Correct |
272 ms |
66408 KB |
Output is correct |
128 |
Correct |
93 ms |
14464 KB |
Output is correct |
129 |
Correct |
140 ms |
20748 KB |
Output is correct |
130 |
Correct |
204 ms |
60016 KB |
Output is correct |
131 |
Correct |
220 ms |
64092 KB |
Output is correct |
132 |
Correct |
242 ms |
64124 KB |
Output is correct |
133 |
Correct |
236 ms |
66452 KB |
Output is correct |
134 |
Correct |
238 ms |
66496 KB |
Output is correct |
135 |
Correct |
223 ms |
66504 KB |
Output is correct |
136 |
Correct |
274 ms |
66400 KB |
Output is correct |
137 |
Correct |
102 ms |
14480 KB |
Output is correct |
138 |
Correct |
102 ms |
14464 KB |
Output is correct |
139 |
Correct |
130 ms |
20756 KB |
Output is correct |
140 |
Correct |
101 ms |
20820 KB |
Output is correct |
141 |
Correct |
4 ms |
1104 KB |
Output is correct |
142 |
Correct |
4 ms |
1104 KB |
Output is correct |
143 |
Correct |
4 ms |
1104 KB |
Output is correct |
144 |
Correct |
2 ms |
464 KB |
Output is correct |
145 |
Correct |
2 ms |
592 KB |
Output is correct |
146 |
Correct |
2 ms |
592 KB |
Output is correct |
147 |
Correct |
4 ms |
1152 KB |
Output is correct |
148 |
Correct |
4 ms |
1104 KB |
Output is correct |
149 |
Correct |
3 ms |
1104 KB |
Output is correct |
150 |
Correct |
4 ms |
1280 KB |
Output is correct |
151 |
Correct |
4 ms |
1280 KB |
Output is correct |
152 |
Correct |
4 ms |
1232 KB |
Output is correct |
153 |
Correct |
3 ms |
464 KB |
Output is correct |
154 |
Correct |
3 ms |
464 KB |
Output is correct |
155 |
Correct |
3 ms |
592 KB |
Output is correct |
156 |
Correct |
3 ms |
592 KB |
Output is correct |
157 |
Correct |
2129 ms |
55640 KB |
Output is correct |
158 |
Correct |
2603 ms |
64100 KB |
Output is correct |
159 |
Correct |
2321 ms |
64136 KB |
Output is correct |
160 |
Correct |
2536 ms |
66480 KB |
Output is correct |
161 |
Correct |
2605 ms |
66540 KB |
Output is correct |
162 |
Correct |
2655 ms |
66488 KB |
Output is correct |
163 |
Correct |
2639 ms |
66520 KB |
Output is correct |
164 |
Correct |
1230 ms |
14536 KB |
Output is correct |
165 |
Correct |
1363 ms |
14476 KB |
Output is correct |
166 |
Correct |
1341 ms |
20736 KB |
Output is correct |
167 |
Correct |
1346 ms |
20724 KB |
Output is correct |
168 |
Correct |
1 ms |
208 KB |
Output is correct |
169 |
Correct |
1566 ms |
21208 KB |
Output is correct |
170 |
Correct |
3142 ms |
64044 KB |
Output is correct |
171 |
Correct |
2832 ms |
64080 KB |
Output is correct |
172 |
Correct |
3233 ms |
66524 KB |
Output is correct |
173 |
Correct |
3242 ms |
66464 KB |
Output is correct |
174 |
Correct |
3612 ms |
66508 KB |
Output is correct |
175 |
Correct |
3270 ms |
66444 KB |
Output is correct |
176 |
Correct |
1386 ms |
14520 KB |
Output is correct |
177 |
Correct |
1449 ms |
14468 KB |
Output is correct |
178 |
Correct |
1341 ms |
20728 KB |
Output is correct |
179 |
Correct |
1275 ms |
20796 KB |
Output is correct |