#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define ff first
#define sz(x) (int)(x).size()
#define sc second
struct fenwick {
int n;
vector<int> t;
fenwick() = default;
fenwick(int n_) {
n = n_;
t.assign(n + 1, 0);
}
void clear() {
t.assign(n + 1, 0);
}
int sum(int x) {
int ans = 0;
for (int i = x; i >= 0; i = (i & (i + 1)) - 1) {
ans += t[i];
}
return ans;
}
void upd(int pos, int delta) {
for (int i = pos; i < n; i = i | (i + 1)) {
t[i] += delta;
}
}
};
int sp[18][200010];
signed main() {
ios_base::sync_with_stdio(false);
cout.tie(nullptr);
vector<int> Log2(200010);
for (int i = 2; i < 200010; i++) {
Log2[i] = Log2[i / 2] + 1;
}
int n, m, q; cin >> n >> m >> q;
vector<vector<int>> g(n);
for (int i = 0; i < n - 1; i++) {
int u, v; cin >> u >> v;
u--; v--;
g[u].pb(v);
g[v].pb(u);
}
vector<vector<int>> num(n);
vector<int> c(m);
for (int i = 0; i < m; i++) {
cin >> c[i];
c[i]--;
num[c[i]].pb(i);
}
vector<pair<int, int>> segs;
vector<vector<int>> evs;
vector<set<int>> sub(n);
unordered_map<ll, int> pos;
vector<int> h(n), siz(n);
auto convert = [&](int l, int r) -> ll {
return l * 1ll * m + r;
};
vector<int> htl, vtl, ppos(n);
auto dfs = [&](int v, int p, auto&&dfs) -> void {
htl.pb(h[v]);
vtl.pb(v);
ppos[v] = sz(vtl) - 1;
siz[v] = sz(num[v]);
vector<int> sons;
for (auto &u : g[v]) {
if (u != p) {
h[u] = h[v] + 1;
sons.pb(u);
dfs(u, v, dfs);
htl.pb(h[v]);
vtl.pb(v);
siz[v] += siz[u];
}
}
auto add_ev = [&](int l, int r) {
if (pos.find(convert(l, r)) == pos.end()) {
pos[convert(l, r)] = sz(segs);
segs.pb({ l, r });
evs.pb({});
}
if (l == 0 && r == m - 1) {
evs[pos[convert(l, r)]].pb(h[v]);
evs[pos[convert(l, r)]].pb(h[v] - 1);
return;
}
evs[pos[convert(l, r)]].pb(h[v]);
};
if (sons.empty()) {
if (num[v].empty()) {
add_ev(0, m - 1);
return;
}
sub[v].insert(num[v][0]);
segs.pb({0, num[v][0] - 1});
evs.pb({h[v]});
pos[convert(0, num[v][0] - 1)] = sz(segs) - 1;
segs.pb({num[v][0] + 1, m - 1});
pos[convert(num[v][0] + 1, m - 1)] = sz(segs) - 1;
evs.pb({h[v]});
for (int j = 1; j < sz(num[v]); j++) {
int el = num[v][j];
auto it = sub[v].lower_bound(el);
if (it == sub[v].end()) {
int lst = (*sub[v].rbegin());
add_ev(lst + 1, m - 1);
add_ev(lst + 1, el - 1);
add_ev(el + 1, m - 1);
}
else if (it == sub[v].begin()) {
int bg = *it;
add_ev(0, bg - 1);
add_ev(el + 1, bg - 1);
add_ev(0, el - 1);
}
else {
int nxt = *it;
it--;
int pr = *it;
add_ev(pr + 1, nxt - 1);
add_ev(pr + 1, el - 1);
add_ev(el + 1, nxt - 1);
}
sub[v].insert(el);
}
return;
}
int maxson = sons[0];
for (int i = 1; i < sz(sons); i++) {
if (siz[sons[i]] > siz[maxson]) maxson = sons[i];
}
swap(sub[v], sub[maxson]);
if (sz(sub[v]) == 0) {
if (num[v].empty()) {
add_ev(0, m - 1);
return;
}
sub[v].insert(num[v][0]);
segs.pb({ 0, num[v][0] - 1 });
evs.pb({ h[v] });
pos[convert(0, num[v][0] - 1)] = sz(segs) - 1;
segs.pb({ num[v][0] + 1, m - 1 });
pos[convert(num[v][0] + 1, m - 1)] = sz(segs) - 1;
evs.pb({ h[v] });
for (int j = 1; j < sz(num[v]); j++) {
int el = num[v][j];
auto it = sub[v].lower_bound(el);
if (it == sub[v].end()) {
int lst = (*sub[v].rbegin());
add_ev(lst + 1, m - 1);
add_ev(lst + 1, el - 1);
add_ev(el + 1, m - 1);
}
else if (it == sub[v].begin()) {
int bg = *it;
add_ev(0, bg - 1);
add_ev(el + 1, bg - 1);
add_ev(0, el - 1);
}
else {
int nxt = *it;
it--;
int pr = *it;
add_ev(pr + 1, nxt - 1);
add_ev(pr + 1, el - 1);
add_ev(el + 1, nxt - 1);
}
sub[v].insert(el);
}
return;
}
for (int son : sons) {
if (son != maxson) {
int num = 0, prev = -1;
for (int el : sub[son]) {
if (num == 0) {
add_ev(0, el - 1);
}
if (num == sz(sub[son]) - 1) {
add_ev(el + 1, m - 1);
}
if (num > 0) {
add_ev(prev + 1, el - 1);
}
prev = el;
num++;
}
for (int el : sub[son]) {
auto it = sub[v].lower_bound(el);
if (it == sub[v].end()) {
int lst = (*sub[v].rbegin());
add_ev(lst + 1, m - 1);
add_ev(lst + 1, el - 1);
add_ev(el + 1, m - 1);
} else if (it == sub[v].begin()) {
int bg = *it;
add_ev(0, bg - 1);
add_ev(el + 1, bg - 1);
add_ev(0, el - 1);
} else {
int nxt = *it;
it--;
int pr = *it;
add_ev(pr + 1, nxt - 1);
add_ev(pr + 1, el - 1);
add_ev(el + 1, nxt - 1);
}
sub[v].insert(el);
}
sub[son].clear();
}
}
if (!num[v].empty()) {
for (int el : num[v]) {
auto it = sub[v].lower_bound(el);
if (it == sub[v].end()) {
int lst = (*sub[v].rbegin());
add_ev(lst + 1, m - 1);
add_ev(lst + 1, el - 1);
add_ev(el + 1, m - 1);
}
else if (it == sub[v].begin()) {
int bg = *it;
add_ev(0, bg - 1);
add_ev(el + 1, bg - 1);
add_ev(0, el - 1);
}
else {
int nxt = *it;
it--;
int pr = *it;
add_ev(pr + 1, nxt - 1);
add_ev(pr + 1, el - 1);
add_ev(el + 1, nxt - 1);
}
sub[v].insert(el);
}
}
};
dfs(0, 0, dfs);
for (int i = 0; i < sz(vtl); i++) {
sp[0][i] = i;
}
auto comp = [&](int i, int j) {
return (htl[i] < htl[j] ? i : j);
};
for (int pw = 1; pw < 18; pw++) {
for (int i = 0; i + (1 << pw) - 1 < sz(vtl); i++) {
sp[pw][i] = comp(sp[pw - 1][i], sp[pw - 1][i + (1 << (pw - 1))]);
}
}
auto get = [&](int l, int r) {
if (l > r) swap(l, r);
int lg = Log2[r - l + 1];
return comp(sp[lg][l], sp[lg][r - (1 << lg) + 1]);
};
auto lca = [&](int v, int u) {
if (v == -1) return u;
if (u == -1) return v;
return vtl[get(ppos[v], ppos[u])];
};
vector<int> t(4 * m);
auto build = [&](int v, int tl, int tr, auto&&build) -> void {
if (tl + 1 == tr) {
t[v] = c[tl];
return;
}
int tm = (tl + tr) / 2;
build(v * 2, tl, tm, build);
build(v * 2 + 1, tm, tr, build);
t[v] = lca(t[v * 2], t[v * 2 + 1]);
};
auto getlca = [&](int v, int tl, int tr, int l, int r, auto&&getlca) {
if (l <= tl && tr <= r) { return t[v]; }
if (tl >= r || tr <= l) {
return -1;
}
int tm = (tl + tr) / 2;
return lca(getlca(v * 2, tl, tm, l, r, getlca), getlca(v * 2 + 1, tm, tr, l, r, getlca));
};
build(1, 0, m, build);
vector<vector<pair<int, int>>> reqs(m), segss(m);
vector<pair<int, int>> qrs(q);
vector<int> cntt(sz(segs));
for (int i = 0; i < sz(segs); i++) {
for (int j = 0; j < sz(evs[i]); j++) {
if (j % 2 == 0) cntt[i] += evs[i][j];
else cntt[i] -= evs[i][j];
}
if (sz(evs[i]) & 1) cntt[i]++;
if (segs[i].ff < m) {
segss[segs[i].ff].pb({segs[i].sc, cntt[i]});
}
}
for (int i = 0; i < q; i++) {
int l, r; cin >> l >> r;
l--; r--;
qrs[i] = {l, r};
reqs[l].pb({r, i});
}
vector<int> ans(q, 0);
fenwick fw(m + 2);
for (int i = 0; i < m; i++) {
for (auto &u : segss[i]) {
fw.upd(u.ff + 1, u.sc);
}
for (auto &u : reqs[i]) {
ans[u.sc] = n - (fw.sum(m) - fw.sum(u.ff));
}
}
for (int i = 0; i < q; i++) {
cout << ans[i] - h[getlca(1, 0, m, qrs[i].ff, qrs[i].sc + 1, getlca)] << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
5212 KB |
Output is correct |
2 |
Correct |
1 ms |
5212 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7516 KB |
Output is correct |
7 |
Correct |
2 ms |
7516 KB |
Output is correct |
8 |
Correct |
2 ms |
9564 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
2 ms |
9564 KB |
Output is correct |
11 |
Correct |
4 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9564 KB |
Output is correct |
13 |
Correct |
3 ms |
9564 KB |
Output is correct |
14 |
Correct |
2 ms |
9564 KB |
Output is correct |
15 |
Correct |
2 ms |
9560 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
2 ms |
9564 KB |
Output is correct |
18 |
Correct |
2 ms |
9672 KB |
Output is correct |
19 |
Correct |
2 ms |
9564 KB |
Output is correct |
20 |
Correct |
2 ms |
9560 KB |
Output is correct |
21 |
Correct |
2 ms |
9560 KB |
Output is correct |
22 |
Correct |
2 ms |
9564 KB |
Output is correct |
23 |
Correct |
2 ms |
9712 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
2 ms |
9560 KB |
Output is correct |
26 |
Correct |
2 ms |
9564 KB |
Output is correct |
27 |
Correct |
1 ms |
1372 KB |
Output is correct |
28 |
Correct |
2 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
5212 KB |
Output is correct |
2 |
Correct |
1 ms |
5212 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7516 KB |
Output is correct |
7 |
Correct |
2 ms |
7516 KB |
Output is correct |
8 |
Correct |
2 ms |
9564 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
2 ms |
9564 KB |
Output is correct |
11 |
Correct |
4 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9564 KB |
Output is correct |
13 |
Correct |
3 ms |
9564 KB |
Output is correct |
14 |
Correct |
2 ms |
9564 KB |
Output is correct |
15 |
Correct |
2 ms |
9560 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
2 ms |
9564 KB |
Output is correct |
18 |
Correct |
2 ms |
9672 KB |
Output is correct |
19 |
Correct |
2 ms |
9564 KB |
Output is correct |
20 |
Correct |
2 ms |
9560 KB |
Output is correct |
21 |
Correct |
2 ms |
9560 KB |
Output is correct |
22 |
Correct |
2 ms |
9564 KB |
Output is correct |
23 |
Correct |
2 ms |
9712 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
2 ms |
9560 KB |
Output is correct |
26 |
Correct |
2 ms |
9564 KB |
Output is correct |
27 |
Correct |
1 ms |
1372 KB |
Output is correct |
28 |
Correct |
2 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
30 |
Correct |
8 ms |
12952 KB |
Output is correct |
31 |
Correct |
8 ms |
13204 KB |
Output is correct |
32 |
Correct |
10 ms |
13688 KB |
Output is correct |
33 |
Correct |
9 ms |
13464 KB |
Output is correct |
34 |
Correct |
9 ms |
13464 KB |
Output is correct |
35 |
Correct |
9 ms |
13476 KB |
Output is correct |
36 |
Correct |
9 ms |
13508 KB |
Output is correct |
37 |
Correct |
9 ms |
13720 KB |
Output is correct |
38 |
Correct |
6 ms |
13148 KB |
Output is correct |
39 |
Correct |
6 ms |
13256 KB |
Output is correct |
40 |
Correct |
6 ms |
13148 KB |
Output is correct |
41 |
Correct |
6 ms |
13148 KB |
Output is correct |
42 |
Correct |
7 ms |
13148 KB |
Output is correct |
43 |
Correct |
6 ms |
13144 KB |
Output is correct |
44 |
Correct |
7 ms |
13440 KB |
Output is correct |
45 |
Correct |
7 ms |
13148 KB |
Output is correct |
46 |
Correct |
7 ms |
13148 KB |
Output is correct |
47 |
Correct |
7 ms |
13148 KB |
Output is correct |
48 |
Correct |
8 ms |
13148 KB |
Output is correct |
49 |
Correct |
7 ms |
13288 KB |
Output is correct |
50 |
Correct |
7 ms |
13148 KB |
Output is correct |
51 |
Correct |
7 ms |
13148 KB |
Output is correct |
52 |
Correct |
7 ms |
13212 KB |
Output is correct |
53 |
Correct |
7 ms |
13144 KB |
Output is correct |
54 |
Correct |
7 ms |
13148 KB |
Output is correct |
55 |
Correct |
7 ms |
13148 KB |
Output is correct |
56 |
Correct |
3 ms |
1884 KB |
Output is correct |
57 |
Correct |
3 ms |
11956 KB |
Output is correct |
58 |
Correct |
9 ms |
13720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
5212 KB |
Output is correct |
2 |
Correct |
1 ms |
1372 KB |
Output is correct |
3 |
Correct |
4 ms |
1884 KB |
Output is correct |
4 |
Correct |
292 ms |
76772 KB |
Output is correct |
5 |
Correct |
209 ms |
73752 KB |
Output is correct |
6 |
Correct |
281 ms |
87940 KB |
Output is correct |
7 |
Correct |
434 ms |
101080 KB |
Output is correct |
8 |
Correct |
368 ms |
101904 KB |
Output is correct |
9 |
Correct |
372 ms |
101848 KB |
Output is correct |
10 |
Correct |
399 ms |
101392 KB |
Output is correct |
11 |
Correct |
372 ms |
102304 KB |
Output is correct |
12 |
Correct |
271 ms |
100600 KB |
Output is correct |
13 |
Correct |
299 ms |
100144 KB |
Output is correct |
14 |
Correct |
282 ms |
100256 KB |
Output is correct |
15 |
Correct |
73 ms |
60720 KB |
Output is correct |
16 |
Correct |
317 ms |
100804 KB |
Output is correct |
17 |
Correct |
184 ms |
44344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
5208 KB |
Output is correct |
2 |
Correct |
470 ms |
88408 KB |
Output is correct |
3 |
Correct |
880 ms |
133136 KB |
Output is correct |
4 |
Correct |
616 ms |
105292 KB |
Output is correct |
5 |
Correct |
1060 ms |
156340 KB |
Output is correct |
6 |
Correct |
1032 ms |
154380 KB |
Output is correct |
7 |
Correct |
1022 ms |
154308 KB |
Output is correct |
8 |
Correct |
1105 ms |
154012 KB |
Output is correct |
9 |
Correct |
1094 ms |
157044 KB |
Output is correct |
10 |
Correct |
1070 ms |
156096 KB |
Output is correct |
11 |
Correct |
1027 ms |
153892 KB |
Output is correct |
12 |
Correct |
1092 ms |
154840 KB |
Output is correct |
13 |
Correct |
1043 ms |
155024 KB |
Output is correct |
14 |
Correct |
1077 ms |
156484 KB |
Output is correct |
15 |
Correct |
1135 ms |
161992 KB |
Output is correct |
16 |
Correct |
1018 ms |
151228 KB |
Output is correct |
17 |
Correct |
1026 ms |
154556 KB |
Output is correct |
18 |
Correct |
1000 ms |
152836 KB |
Output is correct |
19 |
Correct |
722 ms |
122584 KB |
Output is correct |
20 |
Correct |
753 ms |
122600 KB |
Output is correct |
21 |
Correct |
757 ms |
126896 KB |
Output is correct |
22 |
Correct |
738 ms |
125252 KB |
Output is correct |
23 |
Correct |
719 ms |
121344 KB |
Output is correct |
24 |
Correct |
721 ms |
121420 KB |
Output is correct |
25 |
Correct |
721 ms |
122872 KB |
Output is correct |
26 |
Correct |
757 ms |
123232 KB |
Output is correct |
27 |
Correct |
727 ms |
122968 KB |
Output is correct |
28 |
Correct |
760 ms |
123288 KB |
Output is correct |
29 |
Correct |
729 ms |
124504 KB |
Output is correct |
30 |
Correct |
777 ms |
126820 KB |
Output is correct |
31 |
Correct |
756 ms |
124748 KB |
Output is correct |
32 |
Correct |
799 ms |
127000 KB |
Output is correct |
33 |
Correct |
817 ms |
130872 KB |
Output is correct |
34 |
Correct |
726 ms |
125784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
5208 KB |
Output is correct |
2 |
Correct |
1 ms |
1372 KB |
Output is correct |
3 |
Correct |
4 ms |
1880 KB |
Output is correct |
4 |
Correct |
1215 ms |
168876 KB |
Output is correct |
5 |
Correct |
1262 ms |
174728 KB |
Output is correct |
6 |
Correct |
1403 ms |
193612 KB |
Output is correct |
7 |
Correct |
1444 ms |
200300 KB |
Output is correct |
8 |
Correct |
1419 ms |
198792 KB |
Output is correct |
9 |
Correct |
1403 ms |
198976 KB |
Output is correct |
10 |
Correct |
1548 ms |
197880 KB |
Output is correct |
11 |
Correct |
1397 ms |
200328 KB |
Output is correct |
12 |
Correct |
1478 ms |
199372 KB |
Output is correct |
13 |
Correct |
1473 ms |
199656 KB |
Output is correct |
14 |
Correct |
188 ms |
43320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
5212 KB |
Output is correct |
2 |
Correct |
1 ms |
5212 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7516 KB |
Output is correct |
7 |
Correct |
2 ms |
7516 KB |
Output is correct |
8 |
Correct |
2 ms |
9564 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
2 ms |
9564 KB |
Output is correct |
11 |
Correct |
4 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9564 KB |
Output is correct |
13 |
Correct |
3 ms |
9564 KB |
Output is correct |
14 |
Correct |
2 ms |
9564 KB |
Output is correct |
15 |
Correct |
2 ms |
9560 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
2 ms |
9564 KB |
Output is correct |
18 |
Correct |
2 ms |
9672 KB |
Output is correct |
19 |
Correct |
2 ms |
9564 KB |
Output is correct |
20 |
Correct |
2 ms |
9560 KB |
Output is correct |
21 |
Correct |
2 ms |
9560 KB |
Output is correct |
22 |
Correct |
2 ms |
9564 KB |
Output is correct |
23 |
Correct |
2 ms |
9712 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
2 ms |
9560 KB |
Output is correct |
26 |
Correct |
2 ms |
9564 KB |
Output is correct |
27 |
Correct |
1 ms |
1372 KB |
Output is correct |
28 |
Correct |
2 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
30 |
Correct |
8 ms |
12952 KB |
Output is correct |
31 |
Correct |
8 ms |
13204 KB |
Output is correct |
32 |
Correct |
10 ms |
13688 KB |
Output is correct |
33 |
Correct |
9 ms |
13464 KB |
Output is correct |
34 |
Correct |
9 ms |
13464 KB |
Output is correct |
35 |
Correct |
9 ms |
13476 KB |
Output is correct |
36 |
Correct |
9 ms |
13508 KB |
Output is correct |
37 |
Correct |
9 ms |
13720 KB |
Output is correct |
38 |
Correct |
6 ms |
13148 KB |
Output is correct |
39 |
Correct |
6 ms |
13256 KB |
Output is correct |
40 |
Correct |
6 ms |
13148 KB |
Output is correct |
41 |
Correct |
6 ms |
13148 KB |
Output is correct |
42 |
Correct |
7 ms |
13148 KB |
Output is correct |
43 |
Correct |
6 ms |
13144 KB |
Output is correct |
44 |
Correct |
7 ms |
13440 KB |
Output is correct |
45 |
Correct |
7 ms |
13148 KB |
Output is correct |
46 |
Correct |
7 ms |
13148 KB |
Output is correct |
47 |
Correct |
7 ms |
13148 KB |
Output is correct |
48 |
Correct |
8 ms |
13148 KB |
Output is correct |
49 |
Correct |
7 ms |
13288 KB |
Output is correct |
50 |
Correct |
7 ms |
13148 KB |
Output is correct |
51 |
Correct |
7 ms |
13148 KB |
Output is correct |
52 |
Correct |
7 ms |
13212 KB |
Output is correct |
53 |
Correct |
7 ms |
13144 KB |
Output is correct |
54 |
Correct |
7 ms |
13148 KB |
Output is correct |
55 |
Correct |
7 ms |
13148 KB |
Output is correct |
56 |
Correct |
3 ms |
1884 KB |
Output is correct |
57 |
Correct |
3 ms |
11956 KB |
Output is correct |
58 |
Correct |
9 ms |
13720 KB |
Output is correct |
59 |
Correct |
1 ms |
5212 KB |
Output is correct |
60 |
Correct |
1 ms |
1372 KB |
Output is correct |
61 |
Correct |
4 ms |
1884 KB |
Output is correct |
62 |
Correct |
292 ms |
76772 KB |
Output is correct |
63 |
Correct |
209 ms |
73752 KB |
Output is correct |
64 |
Correct |
281 ms |
87940 KB |
Output is correct |
65 |
Correct |
434 ms |
101080 KB |
Output is correct |
66 |
Correct |
368 ms |
101904 KB |
Output is correct |
67 |
Correct |
372 ms |
101848 KB |
Output is correct |
68 |
Correct |
399 ms |
101392 KB |
Output is correct |
69 |
Correct |
372 ms |
102304 KB |
Output is correct |
70 |
Correct |
271 ms |
100600 KB |
Output is correct |
71 |
Correct |
299 ms |
100144 KB |
Output is correct |
72 |
Correct |
282 ms |
100256 KB |
Output is correct |
73 |
Correct |
73 ms |
60720 KB |
Output is correct |
74 |
Correct |
317 ms |
100804 KB |
Output is correct |
75 |
Correct |
184 ms |
44344 KB |
Output is correct |
76 |
Correct |
1 ms |
5208 KB |
Output is correct |
77 |
Correct |
470 ms |
88408 KB |
Output is correct |
78 |
Correct |
880 ms |
133136 KB |
Output is correct |
79 |
Correct |
616 ms |
105292 KB |
Output is correct |
80 |
Correct |
1060 ms |
156340 KB |
Output is correct |
81 |
Correct |
1032 ms |
154380 KB |
Output is correct |
82 |
Correct |
1022 ms |
154308 KB |
Output is correct |
83 |
Correct |
1105 ms |
154012 KB |
Output is correct |
84 |
Correct |
1094 ms |
157044 KB |
Output is correct |
85 |
Correct |
1070 ms |
156096 KB |
Output is correct |
86 |
Correct |
1027 ms |
153892 KB |
Output is correct |
87 |
Correct |
1092 ms |
154840 KB |
Output is correct |
88 |
Correct |
1043 ms |
155024 KB |
Output is correct |
89 |
Correct |
1077 ms |
156484 KB |
Output is correct |
90 |
Correct |
1135 ms |
161992 KB |
Output is correct |
91 |
Correct |
1018 ms |
151228 KB |
Output is correct |
92 |
Correct |
1026 ms |
154556 KB |
Output is correct |
93 |
Correct |
1000 ms |
152836 KB |
Output is correct |
94 |
Correct |
722 ms |
122584 KB |
Output is correct |
95 |
Correct |
753 ms |
122600 KB |
Output is correct |
96 |
Correct |
757 ms |
126896 KB |
Output is correct |
97 |
Correct |
738 ms |
125252 KB |
Output is correct |
98 |
Correct |
719 ms |
121344 KB |
Output is correct |
99 |
Correct |
721 ms |
121420 KB |
Output is correct |
100 |
Correct |
721 ms |
122872 KB |
Output is correct |
101 |
Correct |
757 ms |
123232 KB |
Output is correct |
102 |
Correct |
727 ms |
122968 KB |
Output is correct |
103 |
Correct |
760 ms |
123288 KB |
Output is correct |
104 |
Correct |
729 ms |
124504 KB |
Output is correct |
105 |
Correct |
777 ms |
126820 KB |
Output is correct |
106 |
Correct |
756 ms |
124748 KB |
Output is correct |
107 |
Correct |
799 ms |
127000 KB |
Output is correct |
108 |
Correct |
817 ms |
130872 KB |
Output is correct |
109 |
Correct |
726 ms |
125784 KB |
Output is correct |
110 |
Correct |
1 ms |
5208 KB |
Output is correct |
111 |
Correct |
1 ms |
1372 KB |
Output is correct |
112 |
Correct |
4 ms |
1880 KB |
Output is correct |
113 |
Correct |
1215 ms |
168876 KB |
Output is correct |
114 |
Correct |
1262 ms |
174728 KB |
Output is correct |
115 |
Correct |
1403 ms |
193612 KB |
Output is correct |
116 |
Correct |
1444 ms |
200300 KB |
Output is correct |
117 |
Correct |
1419 ms |
198792 KB |
Output is correct |
118 |
Correct |
1403 ms |
198976 KB |
Output is correct |
119 |
Correct |
1548 ms |
197880 KB |
Output is correct |
120 |
Correct |
1397 ms |
200328 KB |
Output is correct |
121 |
Correct |
1478 ms |
199372 KB |
Output is correct |
122 |
Correct |
1473 ms |
199656 KB |
Output is correct |
123 |
Correct |
188 ms |
43320 KB |
Output is correct |
124 |
Correct |
893 ms |
134820 KB |
Output is correct |
125 |
Correct |
663 ms |
108872 KB |
Output is correct |
126 |
Correct |
1180 ms |
160888 KB |
Output is correct |
127 |
Correct |
1189 ms |
162388 KB |
Output is correct |
128 |
Correct |
1220 ms |
162356 KB |
Output is correct |
129 |
Correct |
1121 ms |
161096 KB |
Output is correct |
130 |
Correct |
1113 ms |
159136 KB |
Output is correct |
131 |
Correct |
397 ms |
100800 KB |
Output is correct |
132 |
Correct |
425 ms |
102172 KB |
Output is correct |
133 |
Correct |
480 ms |
99588 KB |
Output is correct |
134 |
Correct |
820 ms |
125768 KB |
Output is correct |
135 |
Correct |
879 ms |
130220 KB |
Output is correct |
136 |
Correct |
839 ms |
128972 KB |
Output is correct |
137 |
Correct |
600 ms |
102944 KB |
Output is correct |
138 |
Correct |
573 ms |
103236 KB |
Output is correct |
139 |
Correct |
604 ms |
102312 KB |
Output is correct |
140 |
Correct |
586 ms |
102796 KB |
Output is correct |
141 |
Correct |
561 ms |
102176 KB |
Output is correct |
142 |
Correct |
577 ms |
102464 KB |
Output is correct |
143 |
Correct |
66 ms |
34316 KB |
Output is correct |
144 |
Correct |
1092 ms |
161064 KB |
Output is correct |