#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "/home/hp/contests/debug.h"
#else
#define debug(...) void(37)
#endif
constexpr int max_D = int(1e9) + 1;
template<typename T, typename F = function<T(const T&, const T&)>>
struct SparseTable {
vector<vector<T>> table;
int n;
F op;
SparseTable () {}
SparseTable(vector<T> a, F _op) : op(_op) {
n = int(a.size());
int lg = __lg(n) + 1;
table.resize(lg + 1);
table[0] = a;
for (int l = 1; l < lg; ++l) {
int s = n - (1 << l) + 1;
table[l].resize(s);
for (int i = 0; i < s; ++i) {
table[l][i] = op(table[l - 1][i], table[l - 1][i + (1 << (l - 1))]);
}
}
}
T get(int l, int r) {
int lg = __lg(r - l + 1);
return op(table[lg][l], table[lg][r - (1 << lg) + 1]);
}
};
constexpr int MAX_NODES = int(2e5) * 20 * 8;
int max_N = int(1e5);
namespace PST {
int t = 0;
struct info {
int first_id, last_id;
int ct;
info() { }
void init() {
first_id = -1, last_id = -1;
ct = 0;
}
};
info I() {
static info res;
res.init();
return res;
}
info unite(info l, info r) {
info res;
res.first_id = (l.first_id == -1 ? r.first_id : l.first_id);
res.last_id = (r.last_id == -1 ? l.last_id : r.last_id);
res.ct = l.ct + r.ct;
return res;
}
struct node {
int L, R;
info i;
void init() {
L = R = -1;
i.init();
}
void dupe(const node& x) {
L = x.L, R = x.R;
i = x.i;
}
};
node tree[MAX_NODES];
int new_node() {
tree[t].init();
t++;
return t - 1;
}
void pull(int v) {
tree[v].i = unite(tree[v].L == -1 ? I() : tree[tree[v].L].i, tree[v].R == -1 ? I() : tree[tree[v].R].i);
}
int modify(int v, int l, int r, int p, int x) {
int new_v = new_node();
if (v != -1) {
tree[new_v].dupe(tree[v]);
} else {
tree[new_v].init();
}
v = new_v;
if (l == r) {
tree[v].i.last_id = tree[v].i.first_id = x;
tree[v].i.ct = (x != -1);
return v;
}
int mid = (l + r) >> 1;
if (p <= mid) {
tree[v].L = modify(tree[v].L, l, mid, p, x);
} else {
tree[v].R = modify(tree[v].R, mid + 1, r, p, x);
}
pull(v);
//debug("pull", v, l, r, tree[v].i.ct, tree[v].i.first_id, tree[v].i.last_id);
return v;
}
info get(int v, int l, int r, int ll, int rr) {
//debug(v, l, r, tree[v].i.ct, tree[v].i.first_id, tree[v].i.last_id);
if (l >= ll && rr >= r) {
return tree[v].i;
}
int mid = (l + r) >> 1;
info res;
res.init();
if (ll <= mid && tree[v].L != -1) {
res = unite(res, get(tree[v].L, l, mid, ll, rr));
}
if (mid < rr && tree[v].R != -1) {
res = unite(res, get(tree[v].R, mid + 1, r, ll, rr));
}
return res;
}
int modify(int tree_id, int p, int v) {
return modify(tree_id, 0, max_N, p, v);
}
array<int, 3> get_ids(int tree_id, int l, int r) {
auto i = get(tree_id, 0, max_N, l, r);
return {i.first_id, i.last_id, i.ct};
}
};
int N, LG, root;
vector<int> H, L, R, tour, tin, tout;
SparseTable<int> min_H, max_H, lca_st;
int get_lca(int v, int u) {
if (tin[v] > tin[u]) {
swap(v, u);
}
if (tout[v] >= tout[u]) {
return v;
}
return lca_st.get(tout[v], tin[u]);
}
int S;
vector<int> times, segtrees;
int get_time(int x) {
assert(times[0] <= x);
return int(lower_bound(times.begin(), times.end(), x + 1) - times.begin()) - 1;
}
void init(int _N, std::vector<int> _H) {
debug("hello?");
N = _N; H = _H;
LG = __lg(N) + 1;
vector<int> foo(N); iota(foo.begin(), foo.end(), 0);
min_H = SparseTable<int>(foo, [&](int x, int y) {
return (H[x] < H[y] ? x : y);
});
max_H = SparseTable<int>(foo, [&](int x, int y) {
return (H[x] > H[y] ? x : y);
});
vector<vector<int>> g(N);
L.resize(N), R.resize(N), tin.resize(N), tout.resize(N);
vector<int> par(N, -1);
vector<int> mn(N); iota(mn.begin(), mn.end(), 0);
auto Dfs = [&](int l, int r, auto&& Dfs) -> int {
int v = max_H.get(l, r);
tin[v] = int(tour.size());
tour.push_back(v);
L[v] = l, R[v] = r;
if (l != v) {
g[v].push_back(Dfs(l, v - 1, Dfs));
tour.push_back(v);
}
if (r != v) {
g[v].push_back(Dfs(v + 1, r, Dfs));
tour.push_back(v);
}
for (auto u : g[v]) {
if (H[mn[u]] < H[mn[v]]) mn[v] = mn[u];
mn[v] = min(mn[v], mn[u]);
par[u] = v;
}
tout[v] = int(tour.size()) - 1;
return v;
};
root = Dfs(0, N - 1, Dfs);
debug(L, R, par, tour);
debug(tin, tout);
lca_st = SparseTable<int>(tour, [&](int x, int y) {
return H[x] > H[y] ? x : y;
});
vector<int> act_t(N), dis_t(N);
for (int i = 0; i < N; ++i) {
act_t[i] = H[i] - H[mn[i]] + 1;
}
for (int i = 0; i < N; ++i) {
int p = par[i];
dis_t[i] = (p == -1 ? max_D : H[p] - H[mn[i]] + 1);
}
debug(act_t, dis_t);
// each segment is active in the range [act_t_i, dis_t_i)
for (int i = 0; i < N; ++i) {
times.push_back(act_t[i]);
times.push_back(dis_t[i]);
}
sort(times.begin(), times.end());
times.erase(unique(times.begin(), times.end()), times.end());
S = int(times.size());
vector<vector<int>> updates(S);
for (int i = 0; i < N; ++i) {
updates[get_time(dis_t[i])].push_back(~i);
}
for (int i = 0; i < N; ++i) {
updates[get_time(act_t[i])].push_back(i);
}
int segtree = PST::new_node();
for (int i = 0; i < S; ++i) {
debug(i, times[i]);
for (auto x : updates[i]) {
int val, ind;
if (x < 0) {
ind = mn[~x];
val = -1;
} else {
ind = mn[x];
val = mn[x];
}
segtree = PST::modify(segtree, ind, val);
}
//debug(i, segtree);
segtrees.push_back(segtree);
}
}
int max_towers(int QL, int QR, int D) {
int t = get_time(D);
auto[l, r, ct] = PST::get_ids(segtrees[t], QL, QR);
int prev_id = (QL > 0 ? PST::get_ids(segtrees[t], 0, QL - 1)[1] : -1);
int next_id = (QR < N - 1 ? PST::get_ids(segtrees[t], QR + 1, N - 1)[0] : -1);
debug(l, r, prev_id, next_id);
if (l == -1) {
if (prev_id == -1 || next_id == -1) {
return 1;
}
int lca = get_lca(prev_id, next_id);
assert(l <= lca && r <= lca);
if (QL < lca && lca < QR && H[lca] - max(H[min_H.get(QL, lca)], H[min_H.get(lca, QR)]) >= D) {
return 2;
} else {
return 1;
}
} else {
if (prev_id != -1) {
int lca = get_lca(prev_id, l);
debug(lca);
assert(H[lca] - H[l] >= D);
if (QL < lca && H[lca] - H[min_H.get(QL, lca)] >= D) {
ct++;
}
}
if (next_id != -1) {
int lca = get_lca(r, next_id);
assert(H[lca] - H[r] >= D);
if (lca < QR && H[lca] - H[min_H.get(lca, QR)] >= D) {
ct++;
}
}
return ct;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
367 ms |
72588 KB |
Output is correct |
2 |
Correct |
704 ms |
123304 KB |
Output is correct |
3 |
Correct |
739 ms |
123316 KB |
Output is correct |
4 |
Correct |
659 ms |
123572 KB |
Output is correct |
5 |
Correct |
621 ms |
123572 KB |
Output is correct |
6 |
Correct |
709 ms |
123576 KB |
Output is correct |
7 |
Correct |
610 ms |
123616 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
3 ms |
3416 KB |
Output is correct |
10 |
Correct |
3 ms |
3416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
3160 KB |
Output is correct |
3 |
Correct |
3 ms |
3160 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3312 KB |
Output is correct |
6 |
Correct |
2 ms |
3160 KB |
Output is correct |
7 |
Correct |
3 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3416 KB |
Output is correct |
9 |
Correct |
3 ms |
3416 KB |
Output is correct |
10 |
Correct |
3 ms |
3416 KB |
Output is correct |
11 |
Correct |
3 ms |
3416 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
3256 KB |
Output is correct |
14 |
Correct |
2 ms |
3416 KB |
Output is correct |
15 |
Correct |
2 ms |
3160 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
3160 KB |
Output is correct |
18 |
Correct |
3 ms |
3416 KB |
Output is correct |
19 |
Correct |
2 ms |
3416 KB |
Output is correct |
20 |
Correct |
2 ms |
3160 KB |
Output is correct |
21 |
Correct |
3 ms |
3180 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
2 ms |
3416 KB |
Output is correct |
24 |
Correct |
2 ms |
3416 KB |
Output is correct |
25 |
Correct |
1 ms |
2904 KB |
Output is correct |
26 |
Correct |
2 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
3160 KB |
Output is correct |
28 |
Correct |
3 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
2 ms |
3160 KB |
Output is correct |
31 |
Correct |
2 ms |
3252 KB |
Output is correct |
32 |
Correct |
3 ms |
3416 KB |
Output is correct |
33 |
Correct |
3 ms |
3416 KB |
Output is correct |
34 |
Correct |
2 ms |
3440 KB |
Output is correct |
35 |
Correct |
2 ms |
3416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
3160 KB |
Output is correct |
3 |
Correct |
3 ms |
3160 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3312 KB |
Output is correct |
6 |
Correct |
2 ms |
3160 KB |
Output is correct |
7 |
Correct |
3 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3416 KB |
Output is correct |
9 |
Correct |
3 ms |
3416 KB |
Output is correct |
10 |
Correct |
3 ms |
3416 KB |
Output is correct |
11 |
Correct |
3 ms |
3416 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
3256 KB |
Output is correct |
14 |
Correct |
2 ms |
3416 KB |
Output is correct |
15 |
Correct |
2 ms |
3160 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
3160 KB |
Output is correct |
18 |
Correct |
3 ms |
3416 KB |
Output is correct |
19 |
Correct |
2 ms |
3416 KB |
Output is correct |
20 |
Correct |
2 ms |
3160 KB |
Output is correct |
21 |
Correct |
3 ms |
3180 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
2 ms |
3416 KB |
Output is correct |
24 |
Correct |
2 ms |
3416 KB |
Output is correct |
25 |
Correct |
1 ms |
2904 KB |
Output is correct |
26 |
Correct |
2 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
3160 KB |
Output is correct |
28 |
Correct |
3 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
2 ms |
3160 KB |
Output is correct |
31 |
Correct |
2 ms |
3252 KB |
Output is correct |
32 |
Correct |
3 ms |
3416 KB |
Output is correct |
33 |
Correct |
3 ms |
3416 KB |
Output is correct |
34 |
Correct |
2 ms |
3440 KB |
Output is correct |
35 |
Correct |
2 ms |
3416 KB |
Output is correct |
36 |
Correct |
80 ms |
72688 KB |
Output is correct |
37 |
Correct |
137 ms |
112768 KB |
Output is correct |
38 |
Correct |
136 ms |
113012 KB |
Output is correct |
39 |
Correct |
125 ms |
112504 KB |
Output is correct |
40 |
Correct |
122 ms |
112308 KB |
Output is correct |
41 |
Correct |
148 ms |
112564 KB |
Output is correct |
42 |
Correct |
126 ms |
112560 KB |
Output is correct |
43 |
Correct |
82 ms |
123572 KB |
Output is correct |
44 |
Correct |
82 ms |
123572 KB |
Output is correct |
45 |
Correct |
103 ms |
121416 KB |
Output is correct |
46 |
Correct |
88 ms |
120688 KB |
Output is correct |
47 |
Correct |
135 ms |
112820 KB |
Output is correct |
48 |
Correct |
127 ms |
112340 KB |
Output is correct |
49 |
Correct |
124 ms |
112564 KB |
Output is correct |
50 |
Correct |
86 ms |
123584 KB |
Output is correct |
51 |
Correct |
130 ms |
123400 KB |
Output is correct |
52 |
Correct |
162 ms |
113020 KB |
Output is correct |
53 |
Correct |
123 ms |
112392 KB |
Output is correct |
54 |
Correct |
131 ms |
112564 KB |
Output is correct |
55 |
Correct |
112 ms |
123648 KB |
Output is correct |
56 |
Correct |
104 ms |
120992 KB |
Output is correct |
57 |
Correct |
148 ms |
109276 KB |
Output is correct |
58 |
Correct |
122 ms |
112820 KB |
Output is correct |
59 |
Correct |
126 ms |
112892 KB |
Output is correct |
60 |
Correct |
115 ms |
112548 KB |
Output is correct |
61 |
Correct |
140 ms |
112308 KB |
Output is correct |
62 |
Correct |
112 ms |
112308 KB |
Output is correct |
63 |
Correct |
116 ms |
112576 KB |
Output is correct |
64 |
Correct |
84 ms |
123572 KB |
Output is correct |
65 |
Correct |
116 ms |
123544 KB |
Output is correct |
66 |
Correct |
94 ms |
116620 KB |
Output is correct |
67 |
Correct |
103 ms |
123296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
706 ms |
112520 KB |
Output is correct |
2 |
Correct |
826 ms |
112852 KB |
Output is correct |
3 |
Correct |
770 ms |
112780 KB |
Output is correct |
4 |
Correct |
855 ms |
112352 KB |
Output is correct |
5 |
Correct |
791 ms |
112340 KB |
Output is correct |
6 |
Correct |
773 ms |
112532 KB |
Output is correct |
7 |
Correct |
776 ms |
112328 KB |
Output is correct |
8 |
Correct |
541 ms |
123556 KB |
Output is correct |
9 |
Correct |
465 ms |
123572 KB |
Output is correct |
10 |
Correct |
628 ms |
121632 KB |
Output is correct |
11 |
Correct |
600 ms |
121748 KB |
Output is correct |
12 |
Correct |
602 ms |
123572 KB |
Output is correct |
13 |
Correct |
550 ms |
123580 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
3416 KB |
Output is correct |
16 |
Correct |
2 ms |
3416 KB |
Output is correct |
17 |
Correct |
127 ms |
112804 KB |
Output is correct |
18 |
Correct |
114 ms |
112548 KB |
Output is correct |
19 |
Correct |
149 ms |
112536 KB |
Output is correct |
20 |
Correct |
106 ms |
123768 KB |
Output is correct |
21 |
Correct |
116 ms |
123572 KB |
Output is correct |
22 |
Correct |
143 ms |
113000 KB |
Output is correct |
23 |
Correct |
150 ms |
112340 KB |
Output is correct |
24 |
Correct |
124 ms |
112424 KB |
Output is correct |
25 |
Correct |
92 ms |
123768 KB |
Output is correct |
26 |
Correct |
133 ms |
120852 KB |
Output is correct |
27 |
Correct |
3 ms |
3160 KB |
Output is correct |
28 |
Correct |
2 ms |
3300 KB |
Output is correct |
29 |
Correct |
3 ms |
3160 KB |
Output is correct |
30 |
Correct |
2 ms |
3416 KB |
Output is correct |
31 |
Correct |
2 ms |
3416 KB |
Output is correct |
32 |
Correct |
2 ms |
3160 KB |
Output is correct |
33 |
Correct |
2 ms |
3160 KB |
Output is correct |
34 |
Correct |
2 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
3256 KB |
Output is correct |
36 |
Correct |
3 ms |
3416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
193 ms |
26268 KB |
Output is correct |
2 |
Correct |
667 ms |
112816 KB |
Output is correct |
3 |
Correct |
761 ms |
112908 KB |
Output is correct |
4 |
Correct |
658 ms |
112328 KB |
Output is correct |
5 |
Correct |
717 ms |
112308 KB |
Output is correct |
6 |
Correct |
756 ms |
112564 KB |
Output is correct |
7 |
Correct |
677 ms |
112556 KB |
Output is correct |
8 |
Correct |
598 ms |
123572 KB |
Output is correct |
9 |
Correct |
647 ms |
123572 KB |
Output is correct |
10 |
Correct |
705 ms |
118452 KB |
Output is correct |
11 |
Correct |
663 ms |
119220 KB |
Output is correct |
12 |
Correct |
137 ms |
112820 KB |
Output is correct |
13 |
Correct |
129 ms |
112444 KB |
Output is correct |
14 |
Correct |
136 ms |
112556 KB |
Output is correct |
15 |
Correct |
84 ms |
123572 KB |
Output is correct |
16 |
Correct |
109 ms |
121012 KB |
Output is correct |
17 |
Correct |
114 ms |
109684 KB |
Output is correct |
18 |
Correct |
134 ms |
112816 KB |
Output is correct |
19 |
Correct |
128 ms |
112820 KB |
Output is correct |
20 |
Correct |
138 ms |
112332 KB |
Output is correct |
21 |
Correct |
148 ms |
112544 KB |
Output is correct |
22 |
Correct |
126 ms |
112700 KB |
Output is correct |
23 |
Correct |
149 ms |
112348 KB |
Output is correct |
24 |
Correct |
101 ms |
123552 KB |
Output is correct |
25 |
Correct |
110 ms |
123716 KB |
Output is correct |
26 |
Correct |
89 ms |
116628 KB |
Output is correct |
27 |
Correct |
84 ms |
123280 KB |
Output is correct |
28 |
Correct |
2 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
3 ms |
3160 KB |
Output is correct |
31 |
Correct |
2 ms |
3416 KB |
Output is correct |
32 |
Correct |
3 ms |
3416 KB |
Output is correct |
33 |
Correct |
2 ms |
2904 KB |
Output is correct |
34 |
Correct |
2 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
3160 KB |
Output is correct |
36 |
Correct |
2 ms |
3160 KB |
Output is correct |
37 |
Correct |
2 ms |
3160 KB |
Output is correct |
38 |
Correct |
3 ms |
3160 KB |
Output is correct |
39 |
Correct |
2 ms |
3160 KB |
Output is correct |
40 |
Correct |
3 ms |
3416 KB |
Output is correct |
41 |
Correct |
2 ms |
3416 KB |
Output is correct |
42 |
Correct |
3 ms |
3412 KB |
Output is correct |
43 |
Correct |
3 ms |
3416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
3160 KB |
Output is correct |
3 |
Correct |
3 ms |
3160 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3312 KB |
Output is correct |
6 |
Correct |
2 ms |
3160 KB |
Output is correct |
7 |
Correct |
3 ms |
3160 KB |
Output is correct |
8 |
Correct |
3 ms |
3416 KB |
Output is correct |
9 |
Correct |
3 ms |
3416 KB |
Output is correct |
10 |
Correct |
3 ms |
3416 KB |
Output is correct |
11 |
Correct |
3 ms |
3416 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
3256 KB |
Output is correct |
14 |
Correct |
2 ms |
3416 KB |
Output is correct |
15 |
Correct |
2 ms |
3160 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
3160 KB |
Output is correct |
18 |
Correct |
3 ms |
3416 KB |
Output is correct |
19 |
Correct |
2 ms |
3416 KB |
Output is correct |
20 |
Correct |
2 ms |
3160 KB |
Output is correct |
21 |
Correct |
3 ms |
3180 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
2 ms |
3416 KB |
Output is correct |
24 |
Correct |
2 ms |
3416 KB |
Output is correct |
25 |
Correct |
1 ms |
2904 KB |
Output is correct |
26 |
Correct |
2 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
3160 KB |
Output is correct |
28 |
Correct |
3 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
2 ms |
3160 KB |
Output is correct |
31 |
Correct |
2 ms |
3252 KB |
Output is correct |
32 |
Correct |
3 ms |
3416 KB |
Output is correct |
33 |
Correct |
3 ms |
3416 KB |
Output is correct |
34 |
Correct |
2 ms |
3440 KB |
Output is correct |
35 |
Correct |
2 ms |
3416 KB |
Output is correct |
36 |
Correct |
80 ms |
72688 KB |
Output is correct |
37 |
Correct |
137 ms |
112768 KB |
Output is correct |
38 |
Correct |
136 ms |
113012 KB |
Output is correct |
39 |
Correct |
125 ms |
112504 KB |
Output is correct |
40 |
Correct |
122 ms |
112308 KB |
Output is correct |
41 |
Correct |
148 ms |
112564 KB |
Output is correct |
42 |
Correct |
126 ms |
112560 KB |
Output is correct |
43 |
Correct |
82 ms |
123572 KB |
Output is correct |
44 |
Correct |
82 ms |
123572 KB |
Output is correct |
45 |
Correct |
103 ms |
121416 KB |
Output is correct |
46 |
Correct |
88 ms |
120688 KB |
Output is correct |
47 |
Correct |
135 ms |
112820 KB |
Output is correct |
48 |
Correct |
127 ms |
112340 KB |
Output is correct |
49 |
Correct |
124 ms |
112564 KB |
Output is correct |
50 |
Correct |
86 ms |
123584 KB |
Output is correct |
51 |
Correct |
130 ms |
123400 KB |
Output is correct |
52 |
Correct |
162 ms |
113020 KB |
Output is correct |
53 |
Correct |
123 ms |
112392 KB |
Output is correct |
54 |
Correct |
131 ms |
112564 KB |
Output is correct |
55 |
Correct |
112 ms |
123648 KB |
Output is correct |
56 |
Correct |
104 ms |
120992 KB |
Output is correct |
57 |
Correct |
148 ms |
109276 KB |
Output is correct |
58 |
Correct |
122 ms |
112820 KB |
Output is correct |
59 |
Correct |
126 ms |
112892 KB |
Output is correct |
60 |
Correct |
115 ms |
112548 KB |
Output is correct |
61 |
Correct |
140 ms |
112308 KB |
Output is correct |
62 |
Correct |
112 ms |
112308 KB |
Output is correct |
63 |
Correct |
116 ms |
112576 KB |
Output is correct |
64 |
Correct |
84 ms |
123572 KB |
Output is correct |
65 |
Correct |
116 ms |
123544 KB |
Output is correct |
66 |
Correct |
94 ms |
116620 KB |
Output is correct |
67 |
Correct |
103 ms |
123296 KB |
Output is correct |
68 |
Correct |
706 ms |
112520 KB |
Output is correct |
69 |
Correct |
826 ms |
112852 KB |
Output is correct |
70 |
Correct |
770 ms |
112780 KB |
Output is correct |
71 |
Correct |
855 ms |
112352 KB |
Output is correct |
72 |
Correct |
791 ms |
112340 KB |
Output is correct |
73 |
Correct |
773 ms |
112532 KB |
Output is correct |
74 |
Correct |
776 ms |
112328 KB |
Output is correct |
75 |
Correct |
541 ms |
123556 KB |
Output is correct |
76 |
Correct |
465 ms |
123572 KB |
Output is correct |
77 |
Correct |
628 ms |
121632 KB |
Output is correct |
78 |
Correct |
600 ms |
121748 KB |
Output is correct |
79 |
Correct |
602 ms |
123572 KB |
Output is correct |
80 |
Correct |
550 ms |
123580 KB |
Output is correct |
81 |
Correct |
0 ms |
344 KB |
Output is correct |
82 |
Correct |
2 ms |
3416 KB |
Output is correct |
83 |
Correct |
2 ms |
3416 KB |
Output is correct |
84 |
Correct |
127 ms |
112804 KB |
Output is correct |
85 |
Correct |
114 ms |
112548 KB |
Output is correct |
86 |
Correct |
149 ms |
112536 KB |
Output is correct |
87 |
Correct |
106 ms |
123768 KB |
Output is correct |
88 |
Correct |
116 ms |
123572 KB |
Output is correct |
89 |
Correct |
143 ms |
113000 KB |
Output is correct |
90 |
Correct |
150 ms |
112340 KB |
Output is correct |
91 |
Correct |
124 ms |
112424 KB |
Output is correct |
92 |
Correct |
92 ms |
123768 KB |
Output is correct |
93 |
Correct |
133 ms |
120852 KB |
Output is correct |
94 |
Correct |
3 ms |
3160 KB |
Output is correct |
95 |
Correct |
2 ms |
3300 KB |
Output is correct |
96 |
Correct |
3 ms |
3160 KB |
Output is correct |
97 |
Correct |
2 ms |
3416 KB |
Output is correct |
98 |
Correct |
2 ms |
3416 KB |
Output is correct |
99 |
Correct |
2 ms |
3160 KB |
Output is correct |
100 |
Correct |
2 ms |
3160 KB |
Output is correct |
101 |
Correct |
2 ms |
3160 KB |
Output is correct |
102 |
Correct |
2 ms |
3256 KB |
Output is correct |
103 |
Correct |
3 ms |
3416 KB |
Output is correct |
104 |
Correct |
712 ms |
99640 KB |
Output is correct |
105 |
Correct |
779 ms |
112856 KB |
Output is correct |
106 |
Correct |
808 ms |
113008 KB |
Output is correct |
107 |
Correct |
892 ms |
112308 KB |
Output is correct |
108 |
Correct |
883 ms |
112556 KB |
Output is correct |
109 |
Correct |
797 ms |
112328 KB |
Output is correct |
110 |
Correct |
755 ms |
112308 KB |
Output is correct |
111 |
Correct |
592 ms |
123724 KB |
Output is correct |
112 |
Correct |
622 ms |
123572 KB |
Output is correct |
113 |
Correct |
598 ms |
119988 KB |
Output is correct |
114 |
Correct |
618 ms |
117428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
367 ms |
72588 KB |
Output is correct |
2 |
Correct |
704 ms |
123304 KB |
Output is correct |
3 |
Correct |
739 ms |
123316 KB |
Output is correct |
4 |
Correct |
659 ms |
123572 KB |
Output is correct |
5 |
Correct |
621 ms |
123572 KB |
Output is correct |
6 |
Correct |
709 ms |
123576 KB |
Output is correct |
7 |
Correct |
610 ms |
123616 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
3 ms |
3416 KB |
Output is correct |
10 |
Correct |
3 ms |
3416 KB |
Output is correct |
11 |
Correct |
1 ms |
2648 KB |
Output is correct |
12 |
Correct |
2 ms |
3160 KB |
Output is correct |
13 |
Correct |
3 ms |
3160 KB |
Output is correct |
14 |
Correct |
2 ms |
3160 KB |
Output is correct |
15 |
Correct |
2 ms |
3312 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
3 ms |
3160 KB |
Output is correct |
18 |
Correct |
3 ms |
3416 KB |
Output is correct |
19 |
Correct |
3 ms |
3416 KB |
Output is correct |
20 |
Correct |
3 ms |
3416 KB |
Output is correct |
21 |
Correct |
3 ms |
3416 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
2 ms |
3256 KB |
Output is correct |
24 |
Correct |
2 ms |
3416 KB |
Output is correct |
25 |
Correct |
2 ms |
3160 KB |
Output is correct |
26 |
Correct |
2 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
3160 KB |
Output is correct |
28 |
Correct |
3 ms |
3416 KB |
Output is correct |
29 |
Correct |
2 ms |
3416 KB |
Output is correct |
30 |
Correct |
2 ms |
3160 KB |
Output is correct |
31 |
Correct |
3 ms |
3180 KB |
Output is correct |
32 |
Correct |
2 ms |
3160 KB |
Output is correct |
33 |
Correct |
2 ms |
3416 KB |
Output is correct |
34 |
Correct |
2 ms |
3416 KB |
Output is correct |
35 |
Correct |
1 ms |
2904 KB |
Output is correct |
36 |
Correct |
2 ms |
3160 KB |
Output is correct |
37 |
Correct |
2 ms |
3160 KB |
Output is correct |
38 |
Correct |
3 ms |
3160 KB |
Output is correct |
39 |
Correct |
2 ms |
3160 KB |
Output is correct |
40 |
Correct |
2 ms |
3160 KB |
Output is correct |
41 |
Correct |
2 ms |
3252 KB |
Output is correct |
42 |
Correct |
3 ms |
3416 KB |
Output is correct |
43 |
Correct |
3 ms |
3416 KB |
Output is correct |
44 |
Correct |
2 ms |
3440 KB |
Output is correct |
45 |
Correct |
2 ms |
3416 KB |
Output is correct |
46 |
Correct |
80 ms |
72688 KB |
Output is correct |
47 |
Correct |
137 ms |
112768 KB |
Output is correct |
48 |
Correct |
136 ms |
113012 KB |
Output is correct |
49 |
Correct |
125 ms |
112504 KB |
Output is correct |
50 |
Correct |
122 ms |
112308 KB |
Output is correct |
51 |
Correct |
148 ms |
112564 KB |
Output is correct |
52 |
Correct |
126 ms |
112560 KB |
Output is correct |
53 |
Correct |
82 ms |
123572 KB |
Output is correct |
54 |
Correct |
82 ms |
123572 KB |
Output is correct |
55 |
Correct |
103 ms |
121416 KB |
Output is correct |
56 |
Correct |
88 ms |
120688 KB |
Output is correct |
57 |
Correct |
135 ms |
112820 KB |
Output is correct |
58 |
Correct |
127 ms |
112340 KB |
Output is correct |
59 |
Correct |
124 ms |
112564 KB |
Output is correct |
60 |
Correct |
86 ms |
123584 KB |
Output is correct |
61 |
Correct |
130 ms |
123400 KB |
Output is correct |
62 |
Correct |
162 ms |
113020 KB |
Output is correct |
63 |
Correct |
123 ms |
112392 KB |
Output is correct |
64 |
Correct |
131 ms |
112564 KB |
Output is correct |
65 |
Correct |
112 ms |
123648 KB |
Output is correct |
66 |
Correct |
104 ms |
120992 KB |
Output is correct |
67 |
Correct |
148 ms |
109276 KB |
Output is correct |
68 |
Correct |
122 ms |
112820 KB |
Output is correct |
69 |
Correct |
126 ms |
112892 KB |
Output is correct |
70 |
Correct |
115 ms |
112548 KB |
Output is correct |
71 |
Correct |
140 ms |
112308 KB |
Output is correct |
72 |
Correct |
112 ms |
112308 KB |
Output is correct |
73 |
Correct |
116 ms |
112576 KB |
Output is correct |
74 |
Correct |
84 ms |
123572 KB |
Output is correct |
75 |
Correct |
116 ms |
123544 KB |
Output is correct |
76 |
Correct |
94 ms |
116620 KB |
Output is correct |
77 |
Correct |
103 ms |
123296 KB |
Output is correct |
78 |
Correct |
706 ms |
112520 KB |
Output is correct |
79 |
Correct |
826 ms |
112852 KB |
Output is correct |
80 |
Correct |
770 ms |
112780 KB |
Output is correct |
81 |
Correct |
855 ms |
112352 KB |
Output is correct |
82 |
Correct |
791 ms |
112340 KB |
Output is correct |
83 |
Correct |
773 ms |
112532 KB |
Output is correct |
84 |
Correct |
776 ms |
112328 KB |
Output is correct |
85 |
Correct |
541 ms |
123556 KB |
Output is correct |
86 |
Correct |
465 ms |
123572 KB |
Output is correct |
87 |
Correct |
628 ms |
121632 KB |
Output is correct |
88 |
Correct |
600 ms |
121748 KB |
Output is correct |
89 |
Correct |
602 ms |
123572 KB |
Output is correct |
90 |
Correct |
550 ms |
123580 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
2 ms |
3416 KB |
Output is correct |
93 |
Correct |
2 ms |
3416 KB |
Output is correct |
94 |
Correct |
127 ms |
112804 KB |
Output is correct |
95 |
Correct |
114 ms |
112548 KB |
Output is correct |
96 |
Correct |
149 ms |
112536 KB |
Output is correct |
97 |
Correct |
106 ms |
123768 KB |
Output is correct |
98 |
Correct |
116 ms |
123572 KB |
Output is correct |
99 |
Correct |
143 ms |
113000 KB |
Output is correct |
100 |
Correct |
150 ms |
112340 KB |
Output is correct |
101 |
Correct |
124 ms |
112424 KB |
Output is correct |
102 |
Correct |
92 ms |
123768 KB |
Output is correct |
103 |
Correct |
133 ms |
120852 KB |
Output is correct |
104 |
Correct |
3 ms |
3160 KB |
Output is correct |
105 |
Correct |
2 ms |
3300 KB |
Output is correct |
106 |
Correct |
3 ms |
3160 KB |
Output is correct |
107 |
Correct |
2 ms |
3416 KB |
Output is correct |
108 |
Correct |
2 ms |
3416 KB |
Output is correct |
109 |
Correct |
2 ms |
3160 KB |
Output is correct |
110 |
Correct |
2 ms |
3160 KB |
Output is correct |
111 |
Correct |
2 ms |
3160 KB |
Output is correct |
112 |
Correct |
2 ms |
3256 KB |
Output is correct |
113 |
Correct |
3 ms |
3416 KB |
Output is correct |
114 |
Correct |
193 ms |
26268 KB |
Output is correct |
115 |
Correct |
667 ms |
112816 KB |
Output is correct |
116 |
Correct |
761 ms |
112908 KB |
Output is correct |
117 |
Correct |
658 ms |
112328 KB |
Output is correct |
118 |
Correct |
717 ms |
112308 KB |
Output is correct |
119 |
Correct |
756 ms |
112564 KB |
Output is correct |
120 |
Correct |
677 ms |
112556 KB |
Output is correct |
121 |
Correct |
598 ms |
123572 KB |
Output is correct |
122 |
Correct |
647 ms |
123572 KB |
Output is correct |
123 |
Correct |
705 ms |
118452 KB |
Output is correct |
124 |
Correct |
663 ms |
119220 KB |
Output is correct |
125 |
Correct |
137 ms |
112820 KB |
Output is correct |
126 |
Correct |
129 ms |
112444 KB |
Output is correct |
127 |
Correct |
136 ms |
112556 KB |
Output is correct |
128 |
Correct |
84 ms |
123572 KB |
Output is correct |
129 |
Correct |
109 ms |
121012 KB |
Output is correct |
130 |
Correct |
114 ms |
109684 KB |
Output is correct |
131 |
Correct |
134 ms |
112816 KB |
Output is correct |
132 |
Correct |
128 ms |
112820 KB |
Output is correct |
133 |
Correct |
138 ms |
112332 KB |
Output is correct |
134 |
Correct |
148 ms |
112544 KB |
Output is correct |
135 |
Correct |
126 ms |
112700 KB |
Output is correct |
136 |
Correct |
149 ms |
112348 KB |
Output is correct |
137 |
Correct |
101 ms |
123552 KB |
Output is correct |
138 |
Correct |
110 ms |
123716 KB |
Output is correct |
139 |
Correct |
89 ms |
116628 KB |
Output is correct |
140 |
Correct |
84 ms |
123280 KB |
Output is correct |
141 |
Correct |
2 ms |
3160 KB |
Output is correct |
142 |
Correct |
2 ms |
3160 KB |
Output is correct |
143 |
Correct |
3 ms |
3160 KB |
Output is correct |
144 |
Correct |
2 ms |
3416 KB |
Output is correct |
145 |
Correct |
3 ms |
3416 KB |
Output is correct |
146 |
Correct |
2 ms |
2904 KB |
Output is correct |
147 |
Correct |
2 ms |
3160 KB |
Output is correct |
148 |
Correct |
2 ms |
3160 KB |
Output is correct |
149 |
Correct |
2 ms |
3160 KB |
Output is correct |
150 |
Correct |
2 ms |
3160 KB |
Output is correct |
151 |
Correct |
3 ms |
3160 KB |
Output is correct |
152 |
Correct |
2 ms |
3160 KB |
Output is correct |
153 |
Correct |
3 ms |
3416 KB |
Output is correct |
154 |
Correct |
2 ms |
3416 KB |
Output is correct |
155 |
Correct |
3 ms |
3412 KB |
Output is correct |
156 |
Correct |
3 ms |
3416 KB |
Output is correct |
157 |
Correct |
712 ms |
99640 KB |
Output is correct |
158 |
Correct |
779 ms |
112856 KB |
Output is correct |
159 |
Correct |
808 ms |
113008 KB |
Output is correct |
160 |
Correct |
892 ms |
112308 KB |
Output is correct |
161 |
Correct |
883 ms |
112556 KB |
Output is correct |
162 |
Correct |
797 ms |
112328 KB |
Output is correct |
163 |
Correct |
755 ms |
112308 KB |
Output is correct |
164 |
Correct |
592 ms |
123724 KB |
Output is correct |
165 |
Correct |
622 ms |
123572 KB |
Output is correct |
166 |
Correct |
598 ms |
119988 KB |
Output is correct |
167 |
Correct |
618 ms |
117428 KB |
Output is correct |
168 |
Correct |
0 ms |
344 KB |
Output is correct |
169 |
Correct |
501 ms |
39140 KB |
Output is correct |
170 |
Correct |
869 ms |
112908 KB |
Output is correct |
171 |
Correct |
874 ms |
112820 KB |
Output is correct |
172 |
Correct |
890 ms |
112308 KB |
Output is correct |
173 |
Correct |
874 ms |
112308 KB |
Output is correct |
174 |
Correct |
869 ms |
112564 KB |
Output is correct |
175 |
Correct |
897 ms |
112308 KB |
Output is correct |
176 |
Correct |
619 ms |
123556 KB |
Output is correct |
177 |
Correct |
672 ms |
123572 KB |
Output is correct |
178 |
Correct |
659 ms |
118708 KB |
Output is correct |
179 |
Correct |
605 ms |
121340 KB |
Output is correct |