#include <algorithm>
#include <optional>
#include <unordered_set>
#include <vector>
#include <map>
#include <queue>
int n;
std::vector<int> h;
int max_idx;
std::map<int, int> data;
void init(int N, std::vector<int> H) {
n = N;
h = H;
max_idx = 0;
for (int i = 1; i < N; i++) {
if (H[i] > H[max_idx]) {
max_idx = i;
}
}
int towers = 0;
struct D {
int prev;
int max_to_prev;
int next;
int max_to_next;
};
std::vector<D> adj;
for (int i = 0; i < N; i++) {
towers += 1;
int max_to_prev = H[i];
int max_to_next = H[i];
if (i != 0) max_to_prev = std::max(max_to_prev, H[i - 1]);
if (i + 1 != N) max_to_next = std::max(max_to_next, H[i + 1]);
adj.push_back({.prev = i - 1,
.max_to_prev = max_to_prev,
.next = i + 1 == N ? -1 : i + 1,
.max_to_next = max_to_next});
}
struct PQItem {
int priority;
int from;
int to;
bool operator<(const PQItem &rhs) const {
return priority > rhs.priority;
}
};
std::vector<bool> active(adj.size(), true);
std::priority_queue<PQItem> pq;
for (int i = 1; i < adj.size(); i++) {
pq.push({.priority = 0, .from = i - 1, .to = i});
}
while (!pq.empty()) {
auto [priority, from, to] = pq.top();
pq.pop();
if (!active[from] || !active[to]) continue;
data.emplace(priority, towers);
if (H[from] > H[to]) {
int max = adj[to].max_to_prev =
std::max(adj[from].max_to_prev, adj[to].max_to_prev);
adj[to].prev = adj[from].prev;
if (adj[to].prev != -1) {
adj[adj[to].prev].next = to;
pq.push({.priority = max - std::max(H[adj[to].prev], H[to]),
.from = adj[to].prev,
.to = to});
}
towers -= 1;
active[from] = false;
} else {
int max = adj[from].max_to_next =
std::max(adj[from].max_to_next, adj[to].max_to_next);
adj[from].next = adj[to].next;
if (adj[from].next != -1) {
adj[adj[from].next].prev = from;
pq.push({.priority = max - std::max(H[from], H[adj[from].next]),
.from = from,
.to = adj[from].next});
}
towers -= 1;
active[to] = false;
}
}
data.emplace(2'000'000'000, towers);
}
template <typename Node>
struct SegmentTree {
std::vector<Node> nodes;
int offset;
explicit SegmentTree(int sz) : nodes(2 * sz), offset(sz) {}
void update(int idx, const Node &node) {
idx += offset;
nodes[idx] = node;
while (idx /= 2) {
nodes[idx] = nodes[2 * idx] * nodes[2 * idx + 1];
}
}
Node query(int l, int r) const {
Node left, right;
l += offset;
r += offset;
while (l < r) {
if (l & 1) left = left * nodes[l++];
if (r & 1) right = nodes[--r] * right;
l >>= 1;
r >>= 1;
}
return left * right;
}
};
int d;
struct LeftNode {
int a, b, min, max;
LeftNode() : a(-1), b(-1), min(2'000'000'000), max(-2'000'000'000) {}
LeftNode(int a) : a(-1), b(-1), min(a), max(a) {}
LeftNode(int a, int b, int min, int max) : a(a), b(b), min(min), max(max) {}
LeftNode operator*(const LeftNode &rhs) const {
std::pair<int, int> c1 = {b, a};
std::pair<int, int> c2 = {rhs.b, rhs.a};
std::pair<int, int> c3 = {-1, -1};
if (rhs.max >= 0 && rhs.max - min >= d) {
c3 = {rhs.max, min};
}
std::pair<int, int> best = std::max(std::max(c1, c2), c3);
return {best.second, best.first, std::min(min, rhs.min),
std::max(max, rhs.max)};
}
};
struct RightNode {
int a, b, min, max;
RightNode() : a(-1), b(-1), min(2'000'000'000), max(-2'000'000'000) {}
RightNode(int a) : a(-1), b(-1), min(a), max(a) {}
RightNode(int a, int b, int min, int max)
: a(a), b(b), min(min), max(max) {}
RightNode operator*(const RightNode &rhs) const {
std::pair<int, int> c1 = {b, a};
std::pair<int, int> c2 = {rhs.b, rhs.a};
std::pair<int, int> c3 = {-1, -1};
if (max >= 0 && max - rhs.min >= d) {
c3 = {max, rhs.min};
}
std::pair<int, int> best = std::max(std::max(c1, c2), c3);
return {best.second, best.first, std::min(min, rhs.min),
std::max(max, rhs.max)};
}
};
struct PrecomputedData {
std::unordered_set<int> included_s;
std::vector<int> prefix_sums, prev, next;
SegmentTree<LeftNode> left_st;
SegmentTree<RightNode> right_st;
};
std::optional<PrecomputedData> precomputed;
int max_towers(int L, int R, int D) {
if (L == R) return 1;
R += 1;
if (!precomputed) {
d = D;
std::vector<int> included{h[0]};
int intermediary = h[0];
for (int i = 1; i < n; i++) {
if (h[i] > intermediary) {
intermediary = h[i];
} else if (intermediary - included.back() < D) {
if (h[i] < included.back()) {
included.pop_back();
included.push_back(h[i]);
intermediary = h[i];
}
} else if (intermediary - h[i] >= D) {
included.push_back(h[i]);
intermediary = h[i];
}
}
std::unordered_set<int> included_s(included.begin(), included.end());
std::vector<int> prev, next;
int prev_val = -1;
for (int i = 0; i < n; i++) {
if (included_s.count(h[i])) {
prev_val = i;
}
prev.push_back(prev_val);
}
int next_val = -1;
for (int i = n - 1; i >= 0; i--) {
if (included_s.count(h[i])) {
next_val = i;
}
next.push_back(next_val);
}
std::reverse(next.begin(), next.end());
std::vector<int> prefix_sums{1};
prefix_sums.reserve(n + 1);
for (int i = 0; i < n; i++) {
prefix_sums.push_back(prefix_sums.back() + included_s.count(h[i]));
}
int o = 1;
while (o < n) o *= 2;
SegmentTree<LeftNode> left_st(o);
SegmentTree<RightNode> right_st(o);
for (int i = 0; i < n; i++) {
left_st.update(i, LeftNode(h[i]));
right_st.update(i, RightNode(h[i]));
}
precomputed = std::make_optional(PrecomputedData{
included_s, prefix_sums, prev, next, left_st, right_st});
}
if (L == 0 && R == n) {
return data.lower_bound(D)->second;
}
if (D != d) {
if (R - 1 <= max_idx) {
return 1;
}
if (L >= max_idx) {
return 1;
}
int a = h[L];
int b = h[R - 1];
int c = h[max_idx];
if (c - a >= D && c - b >= D) {
return 2;
} else {
return 1;
}
}
int total = precomputed->prefix_sums[R] - precomputed->prefix_sums[L];
int next = precomputed->next[L];
auto q0 = precomputed->left_st.query(L, next);
if (q0.b - h[next] >= D) {
total += 1;
}
int prev = precomputed->prev[R - 1];
auto q1 = precomputed->right_st.query(prev + 1, R);
if (q1.b - h[prev] >= D) {
total += 1;
}
return std::max(total, 1);
}
Compilation message
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:59:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<init(int, std::vector<int>)::D>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
59 | for (int i = 1; i < adj.size(); i++) {
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
384 ms |
10372 KB |
Output is correct |
2 |
Correct |
680 ms |
20144 KB |
Output is correct |
3 |
Correct |
716 ms |
20108 KB |
Output is correct |
4 |
Correct |
762 ms |
20196 KB |
Output is correct |
5 |
Correct |
877 ms |
20332 KB |
Output is correct |
6 |
Correct |
729 ms |
20092 KB |
Output is correct |
7 |
Correct |
663 ms |
20168 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
592 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
592 KB |
Output is correct |
4 |
Correct |
2 ms |
720 KB |
Output is correct |
5 |
Correct |
1 ms |
592 KB |
Output is correct |
6 |
Correct |
2 ms |
720 KB |
Output is correct |
7 |
Correct |
1 ms |
664 KB |
Output is correct |
8 |
Correct |
1 ms |
592 KB |
Output is correct |
9 |
Correct |
1 ms |
592 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
592 KB |
Output is correct |
14 |
Correct |
1 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
720 KB |
Output is correct |
17 |
Correct |
2 ms |
720 KB |
Output is correct |
18 |
Correct |
1 ms |
612 KB |
Output is correct |
19 |
Correct |
1 ms |
592 KB |
Output is correct |
20 |
Correct |
2 ms |
592 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
2 ms |
720 KB |
Output is correct |
23 |
Correct |
1 ms |
592 KB |
Output is correct |
24 |
Correct |
1 ms |
592 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
1 ms |
592 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
2 ms |
640 KB |
Output is correct |
34 |
Correct |
1 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
592 KB |
Output is correct |
4 |
Correct |
2 ms |
720 KB |
Output is correct |
5 |
Correct |
1 ms |
592 KB |
Output is correct |
6 |
Correct |
2 ms |
720 KB |
Output is correct |
7 |
Correct |
1 ms |
664 KB |
Output is correct |
8 |
Correct |
1 ms |
592 KB |
Output is correct |
9 |
Correct |
1 ms |
592 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
592 KB |
Output is correct |
14 |
Correct |
1 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
720 KB |
Output is correct |
17 |
Correct |
2 ms |
720 KB |
Output is correct |
18 |
Correct |
1 ms |
612 KB |
Output is correct |
19 |
Correct |
1 ms |
592 KB |
Output is correct |
20 |
Correct |
2 ms |
592 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
2 ms |
720 KB |
Output is correct |
23 |
Correct |
1 ms |
592 KB |
Output is correct |
24 |
Correct |
1 ms |
592 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
1 ms |
592 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
2 ms |
640 KB |
Output is correct |
34 |
Correct |
1 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
620 KB |
Output is correct |
36 |
Correct |
55 ms |
13204 KB |
Output is correct |
37 |
Correct |
79 ms |
22096 KB |
Output is correct |
38 |
Correct |
86 ms |
23264 KB |
Output is correct |
39 |
Correct |
78 ms |
22368 KB |
Output is correct |
40 |
Correct |
92 ms |
25528 KB |
Output is correct |
41 |
Correct |
86 ms |
24060 KB |
Output is correct |
42 |
Correct |
92 ms |
26324 KB |
Output is correct |
43 |
Correct |
57 ms |
20148 KB |
Output is correct |
44 |
Correct |
62 ms |
20224 KB |
Output is correct |
45 |
Correct |
61 ms |
20172 KB |
Output is correct |
46 |
Correct |
67 ms |
20188 KB |
Output is correct |
47 |
Correct |
93 ms |
24128 KB |
Output is correct |
48 |
Correct |
92 ms |
26316 KB |
Output is correct |
49 |
Correct |
91 ms |
26360 KB |
Output is correct |
50 |
Correct |
67 ms |
20172 KB |
Output is correct |
51 |
Correct |
64 ms |
20164 KB |
Output is correct |
52 |
Correct |
86 ms |
24128 KB |
Output is correct |
53 |
Correct |
94 ms |
26264 KB |
Output is correct |
54 |
Correct |
95 ms |
26296 KB |
Output is correct |
55 |
Correct |
67 ms |
20128 KB |
Output is correct |
56 |
Correct |
69 ms |
20164 KB |
Output is correct |
57 |
Correct |
78 ms |
22168 KB |
Output is correct |
58 |
Correct |
82 ms |
22872 KB |
Output is correct |
59 |
Correct |
87 ms |
23376 KB |
Output is correct |
60 |
Correct |
94 ms |
26344 KB |
Output is correct |
61 |
Correct |
92 ms |
25748 KB |
Output is correct |
62 |
Correct |
88 ms |
24568 KB |
Output is correct |
63 |
Correct |
89 ms |
25760 KB |
Output is correct |
64 |
Correct |
57 ms |
20088 KB |
Output is correct |
65 |
Correct |
63 ms |
20144 KB |
Output is correct |
66 |
Correct |
68 ms |
20140 KB |
Output is correct |
67 |
Correct |
63 ms |
20172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
667 ms |
23972 KB |
Output is correct |
2 |
Correct |
855 ms |
24120 KB |
Output is correct |
3 |
Correct |
862 ms |
24144 KB |
Output is correct |
4 |
Correct |
750 ms |
26360 KB |
Output is correct |
5 |
Correct |
739 ms |
26324 KB |
Output is correct |
6 |
Correct |
784 ms |
26252 KB |
Output is correct |
7 |
Correct |
767 ms |
26360 KB |
Output is correct |
8 |
Correct |
734 ms |
20088 KB |
Output is correct |
9 |
Correct |
883 ms |
20088 KB |
Output is correct |
10 |
Correct |
762 ms |
20164 KB |
Output is correct |
11 |
Correct |
885 ms |
20168 KB |
Output is correct |
12 |
Correct |
815 ms |
20216 KB |
Output is correct |
13 |
Correct |
855 ms |
20156 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
592 KB |
Output is correct |
16 |
Correct |
1 ms |
592 KB |
Output is correct |
17 |
Correct |
88 ms |
24092 KB |
Output is correct |
18 |
Correct |
105 ms |
26356 KB |
Output is correct |
19 |
Correct |
96 ms |
26292 KB |
Output is correct |
20 |
Correct |
71 ms |
20176 KB |
Output is correct |
21 |
Correct |
65 ms |
20160 KB |
Output is correct |
22 |
Correct |
88 ms |
24092 KB |
Output is correct |
23 |
Correct |
96 ms |
26248 KB |
Output is correct |
24 |
Correct |
95 ms |
26288 KB |
Output is correct |
25 |
Correct |
70 ms |
20168 KB |
Output is correct |
26 |
Correct |
63 ms |
20148 KB |
Output is correct |
27 |
Correct |
2 ms |
592 KB |
Output is correct |
28 |
Correct |
2 ms |
720 KB |
Output is correct |
29 |
Correct |
2 ms |
720 KB |
Output is correct |
30 |
Correct |
1 ms |
592 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
2 ms |
700 KB |
Output is correct |
33 |
Correct |
2 ms |
720 KB |
Output is correct |
34 |
Correct |
2 ms |
720 KB |
Output is correct |
35 |
Correct |
1 ms |
592 KB |
Output is correct |
36 |
Correct |
1 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
287 ms |
6096 KB |
Output is correct |
2 |
Correct |
847 ms |
23196 KB |
Output is correct |
3 |
Correct |
867 ms |
24000 KB |
Output is correct |
4 |
Correct |
895 ms |
23516 KB |
Output is correct |
5 |
Correct |
896 ms |
23548 KB |
Output is correct |
6 |
Correct |
657 ms |
22308 KB |
Output is correct |
7 |
Correct |
726 ms |
23536 KB |
Output is correct |
8 |
Correct |
703 ms |
20172 KB |
Output is correct |
9 |
Correct |
731 ms |
20096 KB |
Output is correct |
10 |
Correct |
688 ms |
20164 KB |
Output is correct |
11 |
Correct |
594 ms |
20160 KB |
Output is correct |
12 |
Correct |
87 ms |
24184 KB |
Output is correct |
13 |
Correct |
94 ms |
26252 KB |
Output is correct |
14 |
Correct |
92 ms |
26320 KB |
Output is correct |
15 |
Correct |
76 ms |
20212 KB |
Output is correct |
16 |
Correct |
68 ms |
20184 KB |
Output is correct |
17 |
Correct |
84 ms |
22176 KB |
Output is correct |
18 |
Correct |
83 ms |
22836 KB |
Output is correct |
19 |
Correct |
99 ms |
23476 KB |
Output is correct |
20 |
Correct |
94 ms |
26364 KB |
Output is correct |
21 |
Correct |
92 ms |
25536 KB |
Output is correct |
22 |
Correct |
88 ms |
24640 KB |
Output is correct |
23 |
Correct |
90 ms |
25720 KB |
Output is correct |
24 |
Correct |
57 ms |
20092 KB |
Output is correct |
25 |
Correct |
70 ms |
20344 KB |
Output is correct |
26 |
Correct |
66 ms |
20152 KB |
Output is correct |
27 |
Correct |
84 ms |
20168 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
2 ms |
720 KB |
Output is correct |
30 |
Correct |
2 ms |
720 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
2 ms |
592 KB |
Output is correct |
35 |
Correct |
2 ms |
592 KB |
Output is correct |
36 |
Correct |
2 ms |
592 KB |
Output is correct |
37 |
Correct |
2 ms |
592 KB |
Output is correct |
38 |
Correct |
2 ms |
716 KB |
Output is correct |
39 |
Correct |
2 ms |
592 KB |
Output is correct |
40 |
Correct |
1 ms |
540 KB |
Output is correct |
41 |
Correct |
1 ms |
592 KB |
Output is correct |
42 |
Correct |
1 ms |
592 KB |
Output is correct |
43 |
Correct |
1 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
592 KB |
Output is correct |
4 |
Correct |
2 ms |
720 KB |
Output is correct |
5 |
Correct |
1 ms |
592 KB |
Output is correct |
6 |
Correct |
2 ms |
720 KB |
Output is correct |
7 |
Correct |
1 ms |
664 KB |
Output is correct |
8 |
Correct |
1 ms |
592 KB |
Output is correct |
9 |
Correct |
1 ms |
592 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
620 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
592 KB |
Output is correct |
14 |
Correct |
1 ms |
592 KB |
Output is correct |
15 |
Correct |
2 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
720 KB |
Output is correct |
17 |
Correct |
2 ms |
720 KB |
Output is correct |
18 |
Correct |
1 ms |
612 KB |
Output is correct |
19 |
Correct |
1 ms |
592 KB |
Output is correct |
20 |
Correct |
2 ms |
592 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
2 ms |
720 KB |
Output is correct |
23 |
Correct |
1 ms |
592 KB |
Output is correct |
24 |
Correct |
1 ms |
592 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
1 ms |
592 KB |
Output is correct |
27 |
Correct |
1 ms |
592 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
2 ms |
596 KB |
Output is correct |
30 |
Correct |
2 ms |
596 KB |
Output is correct |
31 |
Correct |
1 ms |
592 KB |
Output is correct |
32 |
Correct |
1 ms |
592 KB |
Output is correct |
33 |
Correct |
2 ms |
640 KB |
Output is correct |
34 |
Correct |
1 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
620 KB |
Output is correct |
36 |
Correct |
55 ms |
13204 KB |
Output is correct |
37 |
Correct |
79 ms |
22096 KB |
Output is correct |
38 |
Correct |
86 ms |
23264 KB |
Output is correct |
39 |
Correct |
78 ms |
22368 KB |
Output is correct |
40 |
Correct |
92 ms |
25528 KB |
Output is correct |
41 |
Correct |
86 ms |
24060 KB |
Output is correct |
42 |
Correct |
92 ms |
26324 KB |
Output is correct |
43 |
Correct |
57 ms |
20148 KB |
Output is correct |
44 |
Correct |
62 ms |
20224 KB |
Output is correct |
45 |
Correct |
61 ms |
20172 KB |
Output is correct |
46 |
Correct |
67 ms |
20188 KB |
Output is correct |
47 |
Correct |
93 ms |
24128 KB |
Output is correct |
48 |
Correct |
92 ms |
26316 KB |
Output is correct |
49 |
Correct |
91 ms |
26360 KB |
Output is correct |
50 |
Correct |
67 ms |
20172 KB |
Output is correct |
51 |
Correct |
64 ms |
20164 KB |
Output is correct |
52 |
Correct |
86 ms |
24128 KB |
Output is correct |
53 |
Correct |
94 ms |
26264 KB |
Output is correct |
54 |
Correct |
95 ms |
26296 KB |
Output is correct |
55 |
Correct |
67 ms |
20128 KB |
Output is correct |
56 |
Correct |
69 ms |
20164 KB |
Output is correct |
57 |
Correct |
78 ms |
22168 KB |
Output is correct |
58 |
Correct |
82 ms |
22872 KB |
Output is correct |
59 |
Correct |
87 ms |
23376 KB |
Output is correct |
60 |
Correct |
94 ms |
26344 KB |
Output is correct |
61 |
Correct |
92 ms |
25748 KB |
Output is correct |
62 |
Correct |
88 ms |
24568 KB |
Output is correct |
63 |
Correct |
89 ms |
25760 KB |
Output is correct |
64 |
Correct |
57 ms |
20088 KB |
Output is correct |
65 |
Correct |
63 ms |
20144 KB |
Output is correct |
66 |
Correct |
68 ms |
20140 KB |
Output is correct |
67 |
Correct |
63 ms |
20172 KB |
Output is correct |
68 |
Correct |
667 ms |
23972 KB |
Output is correct |
69 |
Correct |
855 ms |
24120 KB |
Output is correct |
70 |
Correct |
862 ms |
24144 KB |
Output is correct |
71 |
Correct |
750 ms |
26360 KB |
Output is correct |
72 |
Correct |
739 ms |
26324 KB |
Output is correct |
73 |
Correct |
784 ms |
26252 KB |
Output is correct |
74 |
Correct |
767 ms |
26360 KB |
Output is correct |
75 |
Correct |
734 ms |
20088 KB |
Output is correct |
76 |
Correct |
883 ms |
20088 KB |
Output is correct |
77 |
Correct |
762 ms |
20164 KB |
Output is correct |
78 |
Correct |
885 ms |
20168 KB |
Output is correct |
79 |
Correct |
815 ms |
20216 KB |
Output is correct |
80 |
Correct |
855 ms |
20156 KB |
Output is correct |
81 |
Correct |
1 ms |
208 KB |
Output is correct |
82 |
Correct |
1 ms |
592 KB |
Output is correct |
83 |
Correct |
1 ms |
592 KB |
Output is correct |
84 |
Correct |
88 ms |
24092 KB |
Output is correct |
85 |
Correct |
105 ms |
26356 KB |
Output is correct |
86 |
Correct |
96 ms |
26292 KB |
Output is correct |
87 |
Correct |
71 ms |
20176 KB |
Output is correct |
88 |
Correct |
65 ms |
20160 KB |
Output is correct |
89 |
Correct |
88 ms |
24092 KB |
Output is correct |
90 |
Correct |
96 ms |
26248 KB |
Output is correct |
91 |
Correct |
95 ms |
26288 KB |
Output is correct |
92 |
Correct |
70 ms |
20168 KB |
Output is correct |
93 |
Correct |
63 ms |
20148 KB |
Output is correct |
94 |
Correct |
2 ms |
592 KB |
Output is correct |
95 |
Correct |
2 ms |
720 KB |
Output is correct |
96 |
Correct |
2 ms |
720 KB |
Output is correct |
97 |
Correct |
1 ms |
592 KB |
Output is correct |
98 |
Correct |
1 ms |
592 KB |
Output is correct |
99 |
Correct |
2 ms |
700 KB |
Output is correct |
100 |
Correct |
2 ms |
720 KB |
Output is correct |
101 |
Correct |
2 ms |
720 KB |
Output is correct |
102 |
Correct |
1 ms |
592 KB |
Output is correct |
103 |
Correct |
1 ms |
592 KB |
Output is correct |
104 |
Correct |
743 ms |
22916 KB |
Output is correct |
105 |
Correct |
847 ms |
23344 KB |
Output is correct |
106 |
Correct |
775 ms |
22572 KB |
Output is correct |
107 |
Correct |
630 ms |
24728 KB |
Output is correct |
108 |
Correct |
713 ms |
22444 KB |
Output is correct |
109 |
Correct |
727 ms |
24512 KB |
Output is correct |
110 |
Correct |
859 ms |
26312 KB |
Output is correct |
111 |
Correct |
724 ms |
20180 KB |
Output is correct |
112 |
Correct |
985 ms |
20180 KB |
Output is correct |
113 |
Correct |
854 ms |
20172 KB |
Output is correct |
114 |
Correct |
776 ms |
20176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
384 ms |
10372 KB |
Output is correct |
2 |
Correct |
680 ms |
20144 KB |
Output is correct |
3 |
Correct |
716 ms |
20108 KB |
Output is correct |
4 |
Correct |
762 ms |
20196 KB |
Output is correct |
5 |
Correct |
877 ms |
20332 KB |
Output is correct |
6 |
Correct |
729 ms |
20092 KB |
Output is correct |
7 |
Correct |
663 ms |
20168 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
592 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
0 ms |
336 KB |
Output is correct |
12 |
Correct |
2 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
592 KB |
Output is correct |
14 |
Correct |
2 ms |
720 KB |
Output is correct |
15 |
Correct |
1 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
720 KB |
Output is correct |
17 |
Correct |
1 ms |
664 KB |
Output is correct |
18 |
Correct |
1 ms |
592 KB |
Output is correct |
19 |
Correct |
1 ms |
592 KB |
Output is correct |
20 |
Correct |
1 ms |
596 KB |
Output is correct |
21 |
Correct |
1 ms |
620 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
2 ms |
592 KB |
Output is correct |
24 |
Correct |
1 ms |
592 KB |
Output is correct |
25 |
Correct |
2 ms |
592 KB |
Output is correct |
26 |
Correct |
2 ms |
720 KB |
Output is correct |
27 |
Correct |
2 ms |
720 KB |
Output is correct |
28 |
Correct |
1 ms |
612 KB |
Output is correct |
29 |
Correct |
1 ms |
592 KB |
Output is correct |
30 |
Correct |
2 ms |
592 KB |
Output is correct |
31 |
Correct |
2 ms |
720 KB |
Output is correct |
32 |
Correct |
2 ms |
720 KB |
Output is correct |
33 |
Correct |
1 ms |
592 KB |
Output is correct |
34 |
Correct |
1 ms |
592 KB |
Output is correct |
35 |
Correct |
1 ms |
464 KB |
Output is correct |
36 |
Correct |
1 ms |
592 KB |
Output is correct |
37 |
Correct |
1 ms |
592 KB |
Output is correct |
38 |
Correct |
2 ms |
592 KB |
Output is correct |
39 |
Correct |
2 ms |
596 KB |
Output is correct |
40 |
Correct |
2 ms |
596 KB |
Output is correct |
41 |
Correct |
1 ms |
592 KB |
Output is correct |
42 |
Correct |
1 ms |
592 KB |
Output is correct |
43 |
Correct |
2 ms |
640 KB |
Output is correct |
44 |
Correct |
1 ms |
592 KB |
Output is correct |
45 |
Correct |
1 ms |
620 KB |
Output is correct |
46 |
Correct |
55 ms |
13204 KB |
Output is correct |
47 |
Correct |
79 ms |
22096 KB |
Output is correct |
48 |
Correct |
86 ms |
23264 KB |
Output is correct |
49 |
Correct |
78 ms |
22368 KB |
Output is correct |
50 |
Correct |
92 ms |
25528 KB |
Output is correct |
51 |
Correct |
86 ms |
24060 KB |
Output is correct |
52 |
Correct |
92 ms |
26324 KB |
Output is correct |
53 |
Correct |
57 ms |
20148 KB |
Output is correct |
54 |
Correct |
62 ms |
20224 KB |
Output is correct |
55 |
Correct |
61 ms |
20172 KB |
Output is correct |
56 |
Correct |
67 ms |
20188 KB |
Output is correct |
57 |
Correct |
93 ms |
24128 KB |
Output is correct |
58 |
Correct |
92 ms |
26316 KB |
Output is correct |
59 |
Correct |
91 ms |
26360 KB |
Output is correct |
60 |
Correct |
67 ms |
20172 KB |
Output is correct |
61 |
Correct |
64 ms |
20164 KB |
Output is correct |
62 |
Correct |
86 ms |
24128 KB |
Output is correct |
63 |
Correct |
94 ms |
26264 KB |
Output is correct |
64 |
Correct |
95 ms |
26296 KB |
Output is correct |
65 |
Correct |
67 ms |
20128 KB |
Output is correct |
66 |
Correct |
69 ms |
20164 KB |
Output is correct |
67 |
Correct |
78 ms |
22168 KB |
Output is correct |
68 |
Correct |
82 ms |
22872 KB |
Output is correct |
69 |
Correct |
87 ms |
23376 KB |
Output is correct |
70 |
Correct |
94 ms |
26344 KB |
Output is correct |
71 |
Correct |
92 ms |
25748 KB |
Output is correct |
72 |
Correct |
88 ms |
24568 KB |
Output is correct |
73 |
Correct |
89 ms |
25760 KB |
Output is correct |
74 |
Correct |
57 ms |
20088 KB |
Output is correct |
75 |
Correct |
63 ms |
20144 KB |
Output is correct |
76 |
Correct |
68 ms |
20140 KB |
Output is correct |
77 |
Correct |
63 ms |
20172 KB |
Output is correct |
78 |
Correct |
667 ms |
23972 KB |
Output is correct |
79 |
Correct |
855 ms |
24120 KB |
Output is correct |
80 |
Correct |
862 ms |
24144 KB |
Output is correct |
81 |
Correct |
750 ms |
26360 KB |
Output is correct |
82 |
Correct |
739 ms |
26324 KB |
Output is correct |
83 |
Correct |
784 ms |
26252 KB |
Output is correct |
84 |
Correct |
767 ms |
26360 KB |
Output is correct |
85 |
Correct |
734 ms |
20088 KB |
Output is correct |
86 |
Correct |
883 ms |
20088 KB |
Output is correct |
87 |
Correct |
762 ms |
20164 KB |
Output is correct |
88 |
Correct |
885 ms |
20168 KB |
Output is correct |
89 |
Correct |
815 ms |
20216 KB |
Output is correct |
90 |
Correct |
855 ms |
20156 KB |
Output is correct |
91 |
Correct |
1 ms |
208 KB |
Output is correct |
92 |
Correct |
1 ms |
592 KB |
Output is correct |
93 |
Correct |
1 ms |
592 KB |
Output is correct |
94 |
Correct |
88 ms |
24092 KB |
Output is correct |
95 |
Correct |
105 ms |
26356 KB |
Output is correct |
96 |
Correct |
96 ms |
26292 KB |
Output is correct |
97 |
Correct |
71 ms |
20176 KB |
Output is correct |
98 |
Correct |
65 ms |
20160 KB |
Output is correct |
99 |
Correct |
88 ms |
24092 KB |
Output is correct |
100 |
Correct |
96 ms |
26248 KB |
Output is correct |
101 |
Correct |
95 ms |
26288 KB |
Output is correct |
102 |
Correct |
70 ms |
20168 KB |
Output is correct |
103 |
Correct |
63 ms |
20148 KB |
Output is correct |
104 |
Correct |
2 ms |
592 KB |
Output is correct |
105 |
Correct |
2 ms |
720 KB |
Output is correct |
106 |
Correct |
2 ms |
720 KB |
Output is correct |
107 |
Correct |
1 ms |
592 KB |
Output is correct |
108 |
Correct |
1 ms |
592 KB |
Output is correct |
109 |
Correct |
2 ms |
700 KB |
Output is correct |
110 |
Correct |
2 ms |
720 KB |
Output is correct |
111 |
Correct |
2 ms |
720 KB |
Output is correct |
112 |
Correct |
1 ms |
592 KB |
Output is correct |
113 |
Correct |
1 ms |
592 KB |
Output is correct |
114 |
Correct |
287 ms |
6096 KB |
Output is correct |
115 |
Correct |
847 ms |
23196 KB |
Output is correct |
116 |
Correct |
867 ms |
24000 KB |
Output is correct |
117 |
Correct |
895 ms |
23516 KB |
Output is correct |
118 |
Correct |
896 ms |
23548 KB |
Output is correct |
119 |
Correct |
657 ms |
22308 KB |
Output is correct |
120 |
Correct |
726 ms |
23536 KB |
Output is correct |
121 |
Correct |
703 ms |
20172 KB |
Output is correct |
122 |
Correct |
731 ms |
20096 KB |
Output is correct |
123 |
Correct |
688 ms |
20164 KB |
Output is correct |
124 |
Correct |
594 ms |
20160 KB |
Output is correct |
125 |
Correct |
87 ms |
24184 KB |
Output is correct |
126 |
Correct |
94 ms |
26252 KB |
Output is correct |
127 |
Correct |
92 ms |
26320 KB |
Output is correct |
128 |
Correct |
76 ms |
20212 KB |
Output is correct |
129 |
Correct |
68 ms |
20184 KB |
Output is correct |
130 |
Correct |
84 ms |
22176 KB |
Output is correct |
131 |
Correct |
83 ms |
22836 KB |
Output is correct |
132 |
Correct |
99 ms |
23476 KB |
Output is correct |
133 |
Correct |
94 ms |
26364 KB |
Output is correct |
134 |
Correct |
92 ms |
25536 KB |
Output is correct |
135 |
Correct |
88 ms |
24640 KB |
Output is correct |
136 |
Correct |
90 ms |
25720 KB |
Output is correct |
137 |
Correct |
57 ms |
20092 KB |
Output is correct |
138 |
Correct |
70 ms |
20344 KB |
Output is correct |
139 |
Correct |
66 ms |
20152 KB |
Output is correct |
140 |
Correct |
84 ms |
20168 KB |
Output is correct |
141 |
Correct |
2 ms |
592 KB |
Output is correct |
142 |
Correct |
2 ms |
720 KB |
Output is correct |
143 |
Correct |
2 ms |
720 KB |
Output is correct |
144 |
Correct |
1 ms |
592 KB |
Output is correct |
145 |
Correct |
1 ms |
592 KB |
Output is correct |
146 |
Correct |
1 ms |
336 KB |
Output is correct |
147 |
Correct |
2 ms |
592 KB |
Output is correct |
148 |
Correct |
2 ms |
592 KB |
Output is correct |
149 |
Correct |
2 ms |
592 KB |
Output is correct |
150 |
Correct |
2 ms |
592 KB |
Output is correct |
151 |
Correct |
2 ms |
716 KB |
Output is correct |
152 |
Correct |
2 ms |
592 KB |
Output is correct |
153 |
Correct |
1 ms |
540 KB |
Output is correct |
154 |
Correct |
1 ms |
592 KB |
Output is correct |
155 |
Correct |
1 ms |
592 KB |
Output is correct |
156 |
Correct |
1 ms |
592 KB |
Output is correct |
157 |
Correct |
743 ms |
22916 KB |
Output is correct |
158 |
Correct |
847 ms |
23344 KB |
Output is correct |
159 |
Correct |
775 ms |
22572 KB |
Output is correct |
160 |
Correct |
630 ms |
24728 KB |
Output is correct |
161 |
Correct |
713 ms |
22444 KB |
Output is correct |
162 |
Correct |
727 ms |
24512 KB |
Output is correct |
163 |
Correct |
859 ms |
26312 KB |
Output is correct |
164 |
Correct |
724 ms |
20180 KB |
Output is correct |
165 |
Correct |
985 ms |
20180 KB |
Output is correct |
166 |
Correct |
854 ms |
20172 KB |
Output is correct |
167 |
Correct |
776 ms |
20176 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Incorrect |
487 ms |
10956 KB |
2nd lines differ - on the 1st token, expected: '128', found: '1' |
170 |
Halted |
0 ms |
0 KB |
- |