/*************************************
* author: marvinthang *
* created: 21.03.2023 16:15:05 *
*************************************/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i--; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
template <class U, class V> scan_op(pair <U, V>) { return in >> u.fi >> u.se; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
template <class A, class B> bool minimize(A &a, B b) { if (a > b) { a = b; return true; } return false; }
template <class A, class B> bool maximize(A &a, B b) { if (a < b) { a = b; return true; } return false; }
inline char gc() { // like getchar()
static char buf[1 << 16];
static size_t bc, be;
if (bc >= be) {
buf[0] = 0, bc = 0;
be = fread(buf, 1, sizeof(buf), stdin);
}
return buf[bc++]; // returns 0 on EOF
}
int readInt() {
int a, c;
while ((a = gc()) < 40);
if (a == '-') return -readInt();
while ((c = gc()) >= 48) a = a * 10 + c - 480;
return a - 48;
}
// index from 0
template <class T = int>
struct Fenwick {
T *bit = nullptr;
int n;
Fenwick(int _n = 0) {
resize(_n);
}
void reset(void) {
fill(bit, bit + 1 + n, T(0));
}
void resize(int _n) {
if (bit != nullptr) delete[] bit;
n = _n;
bit = new T[n + 1];
reset();
}
void update(int i, T val) {
assert(0 <= i);
++i;
for (; i <= n; i += i & -i) bit[i] += val;
}
T get(int i) {
if (i < 0) return T(0);
++i;
i = min(i, n);
T res(0);
for (; i > 0; i -= i & -i)
res += bit[i];
return res;
}
int upper_bound(T val) {
int res = 0;
for (int i = __lg(n); i >= 0; --i) {
if ((res | MASK(i)) <= n && val >= bit[res | MASK(i)]) {
res |= MASK(i);
val -= bit[res];
}
}
return res;
}
int lower_bound(T val) {
int res = 0;
for (int i = __lg(n); i >= 0; --i) {
if ((res | MASK(i)) <= n && val > bit[res | MASK(i)]) {
res |= MASK(i);
val -= bit[res];
}
}
return res;
}
};
// end of template
const int MAX = 1e5 + 5;
const int LOG = 20;
int N, M, Q, C[MAX];
vector <int> adj[MAX], pos[MAX];
vector <pair <int, int>> queriesAt[MAX];
void init(void) {
N = readInt(); M = readInt(); Q = readInt();
FOR(i, 1, N) {
int u = readInt(), v = readInt();
adj[u].push_back(v);
adj[v].push_back(u);
}
FORE(i, 1, M) {
C[i] = readInt();
pos[C[i]].push_back(i);
}
REP(i, Q) {
int l = readInt(), r = readInt();
queriesAt[l].emplace_back(r, i);
}
}
int sz[MAX], depth[MAX], in[MAX], tin[MAX], tout[MAX], rin[MAX], nodes[LOG][MAX + MAX], nodeCount, lca[LOG][MAX];
#define MIN_DEPTH(u, v) (depth[(u)] < depth[(v)] ? (u) : (v))
void dfs(int u) {
sz[u] = 1;
static int td = 0;
tin[u] = ++td;
rin[td] = u;
nodes[0][++nodeCount] = u;
in[u] = nodeCount;
for (int v: adj[u]) {
adj[v].erase(find(ALL(adj[v]), u));
depth[v] = depth[u] + 1;
dfs(v);
sz[u] += sz[v];
nodes[0][++nodeCount] = u;
}
tout[u] = td;
}
bool isChild(int u, int v) {
return tin[u] <= tin[v] && tin[v] <= tout[u];
}
int __lca(int u, int v) {
u = in[u]; v = in[v];
if (u > v) swap(u, v);
int h = __lg(v - u + 1);
return MIN_DEPTH(nodes[h][u], nodes[h][v - MASK(h) + 1]);
}
int res[MAX];
vector <pair <int, int>> addAt[MAX];
set <int> s;
void erase(int u) {
for (int i: pos[u]) s.erase(i);
for (int v: adj[u]) erase(v);
}
void add(int u, int cnt) {
for (int i: pos[u]) {
auto it = s.insert(i).fi;
int pre = *prev(it) + 1;
int nxt = *next(it) - 1;
addAt[pre].emplace_back(nxt, cnt);
addAt[pre].emplace_back(i - 1, -cnt);
addAt[i + 1].emplace_back(nxt, -cnt);
}
for (int v: adj[u]) add(v, cnt);
}
void dfs2(int u, int cnt, bool keep) {
int heavy = -1;
for (int v: adj[u]) if (heavy == -1 || sz[heavy] < sz[v]) heavy = v;
for (int v: adj[u]) if (v != heavy) dfs2(v, 1, false);
if (heavy != -1) dfs2(heavy, cnt + 1, true);
for (int i: pos[u]) {
auto it = s.insert(i).fi;
int pre = *prev(it) + 1;
int nxt = *next(it) - 1;
addAt[pre].emplace_back(nxt, cnt);
addAt[pre].emplace_back(i - 1, -cnt);
addAt[i + 1].emplace_back(nxt, -cnt);
}
for (int v: adj[u]) if (v != heavy) add(v, cnt);
if (!keep) erase(u);
}
int get_lca(int u, int v) {
int h = __lg(v - u + 1);
return __lca(lca[h][u], lca[h][v - MASK(h) + 1]);
}
void process(void) {
dfs(1);
FOR(k, 1, LOG) FORE(i, 1, nodeCount - MASK(k) + 1) nodes[k][i] = MIN_DEPTH(nodes[k - 1][i], nodes[k - 1][i + MASK(k - 1)]);
FORE(i, 1, M) lca[0][i] = C[i];
FOR(k, 1, LOG) FORE(i, 1, M - MASK(k) + 1) lca[k][i] = __lca(lca[k - 1][i], lca[k - 1][i + MASK(k - 1)]);
s.insert(0);
s.insert(M + 1);
dfs2(1, 1, 1);
Fenwick <int> bit(M + 1);
FORE(l, 1, M) {
for (auto [r, v]: addAt[l]) {
bit.update(l, v);
bit.update(r + 1, -v);
}
for (auto [r, i]: queriesAt[l]) res[i] = bit.get(r) - depth[get_lca(l, r)];
}
REP(i, Q) cout << res[i] << '\n';
}
int main(void) {
file("tourism");
init();
process();
cerr << "Time elapsed: " << TIME << " s.\n";
return (0^0);
}
Compilation message
tourism.cpp: In function 'int main()':
tourism.cpp:27:57: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
27 | #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
tourism.cpp:239:2: note: in expansion of macro 'file'
239 | file("tourism");
| ^~~~
tourism.cpp:27:90: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
27 | #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tourism.cpp:239:2: note: in expansion of macro 'file'
239 | file("tourism");
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
9684 KB |
Output is correct |
2 |
Correct |
5 ms |
9684 KB |
Output is correct |
3 |
Correct |
4 ms |
9684 KB |
Output is correct |
4 |
Correct |
5 ms |
9844 KB |
Output is correct |
5 |
Correct |
5 ms |
9812 KB |
Output is correct |
6 |
Correct |
5 ms |
9868 KB |
Output is correct |
7 |
Correct |
5 ms |
9840 KB |
Output is correct |
8 |
Correct |
5 ms |
9812 KB |
Output is correct |
9 |
Correct |
5 ms |
9940 KB |
Output is correct |
10 |
Correct |
6 ms |
9916 KB |
Output is correct |
11 |
Correct |
6 ms |
9940 KB |
Output is correct |
12 |
Correct |
5 ms |
9940 KB |
Output is correct |
13 |
Correct |
7 ms |
9900 KB |
Output is correct |
14 |
Correct |
5 ms |
9940 KB |
Output is correct |
15 |
Correct |
5 ms |
9848 KB |
Output is correct |
16 |
Correct |
5 ms |
9844 KB |
Output is correct |
17 |
Correct |
5 ms |
9940 KB |
Output is correct |
18 |
Correct |
5 ms |
9940 KB |
Output is correct |
19 |
Correct |
5 ms |
9940 KB |
Output is correct |
20 |
Correct |
5 ms |
9940 KB |
Output is correct |
21 |
Correct |
5 ms |
9940 KB |
Output is correct |
22 |
Correct |
5 ms |
9940 KB |
Output is correct |
23 |
Correct |
5 ms |
9844 KB |
Output is correct |
24 |
Correct |
5 ms |
9940 KB |
Output is correct |
25 |
Correct |
5 ms |
9848 KB |
Output is correct |
26 |
Correct |
5 ms |
9940 KB |
Output is correct |
27 |
Correct |
5 ms |
9844 KB |
Output is correct |
28 |
Correct |
5 ms |
9812 KB |
Output is correct |
29 |
Correct |
5 ms |
9940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
9684 KB |
Output is correct |
2 |
Correct |
5 ms |
9684 KB |
Output is correct |
3 |
Correct |
4 ms |
9684 KB |
Output is correct |
4 |
Correct |
5 ms |
9844 KB |
Output is correct |
5 |
Correct |
5 ms |
9812 KB |
Output is correct |
6 |
Correct |
5 ms |
9868 KB |
Output is correct |
7 |
Correct |
5 ms |
9840 KB |
Output is correct |
8 |
Correct |
5 ms |
9812 KB |
Output is correct |
9 |
Correct |
5 ms |
9940 KB |
Output is correct |
10 |
Correct |
6 ms |
9916 KB |
Output is correct |
11 |
Correct |
6 ms |
9940 KB |
Output is correct |
12 |
Correct |
5 ms |
9940 KB |
Output is correct |
13 |
Correct |
7 ms |
9900 KB |
Output is correct |
14 |
Correct |
5 ms |
9940 KB |
Output is correct |
15 |
Correct |
5 ms |
9848 KB |
Output is correct |
16 |
Correct |
5 ms |
9844 KB |
Output is correct |
17 |
Correct |
5 ms |
9940 KB |
Output is correct |
18 |
Correct |
5 ms |
9940 KB |
Output is correct |
19 |
Correct |
5 ms |
9940 KB |
Output is correct |
20 |
Correct |
5 ms |
9940 KB |
Output is correct |
21 |
Correct |
5 ms |
9940 KB |
Output is correct |
22 |
Correct |
5 ms |
9940 KB |
Output is correct |
23 |
Correct |
5 ms |
9844 KB |
Output is correct |
24 |
Correct |
5 ms |
9940 KB |
Output is correct |
25 |
Correct |
5 ms |
9848 KB |
Output is correct |
26 |
Correct |
5 ms |
9940 KB |
Output is correct |
27 |
Correct |
5 ms |
9844 KB |
Output is correct |
28 |
Correct |
5 ms |
9812 KB |
Output is correct |
29 |
Correct |
5 ms |
9940 KB |
Output is correct |
30 |
Correct |
7 ms |
10452 KB |
Output is correct |
31 |
Correct |
7 ms |
10580 KB |
Output is correct |
32 |
Correct |
8 ms |
10708 KB |
Output is correct |
33 |
Correct |
11 ms |
10648 KB |
Output is correct |
34 |
Correct |
7 ms |
10648 KB |
Output is correct |
35 |
Correct |
8 ms |
10648 KB |
Output is correct |
36 |
Correct |
8 ms |
10732 KB |
Output is correct |
37 |
Correct |
8 ms |
10656 KB |
Output is correct |
38 |
Correct |
7 ms |
10836 KB |
Output is correct |
39 |
Correct |
7 ms |
10708 KB |
Output is correct |
40 |
Correct |
7 ms |
10780 KB |
Output is correct |
41 |
Correct |
6 ms |
10836 KB |
Output is correct |
42 |
Correct |
7 ms |
10780 KB |
Output is correct |
43 |
Correct |
7 ms |
10780 KB |
Output is correct |
44 |
Correct |
7 ms |
10708 KB |
Output is correct |
45 |
Correct |
7 ms |
10708 KB |
Output is correct |
46 |
Correct |
7 ms |
10708 KB |
Output is correct |
47 |
Correct |
7 ms |
10708 KB |
Output is correct |
48 |
Correct |
7 ms |
10708 KB |
Output is correct |
49 |
Correct |
8 ms |
10708 KB |
Output is correct |
50 |
Correct |
6 ms |
10580 KB |
Output is correct |
51 |
Correct |
7 ms |
10580 KB |
Output is correct |
52 |
Correct |
8 ms |
10708 KB |
Output is correct |
53 |
Correct |
7 ms |
10580 KB |
Output is correct |
54 |
Correct |
7 ms |
10604 KB |
Output is correct |
55 |
Correct |
7 ms |
10656 KB |
Output is correct |
56 |
Correct |
6 ms |
10092 KB |
Output is correct |
57 |
Correct |
6 ms |
10128 KB |
Output is correct |
58 |
Correct |
8 ms |
10652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
9684 KB |
Output is correct |
2 |
Correct |
5 ms |
9844 KB |
Output is correct |
3 |
Correct |
5 ms |
10120 KB |
Output is correct |
4 |
Correct |
125 ms |
48072 KB |
Output is correct |
5 |
Correct |
87 ms |
50576 KB |
Output is correct |
6 |
Correct |
109 ms |
59104 KB |
Output is correct |
7 |
Correct |
140 ms |
66968 KB |
Output is correct |
8 |
Correct |
138 ms |
66960 KB |
Output is correct |
9 |
Correct |
142 ms |
67012 KB |
Output is correct |
10 |
Correct |
143 ms |
67092 KB |
Output is correct |
11 |
Correct |
145 ms |
67040 KB |
Output is correct |
12 |
Correct |
103 ms |
65876 KB |
Output is correct |
13 |
Correct |
111 ms |
65820 KB |
Output is correct |
14 |
Correct |
98 ms |
65844 KB |
Output is correct |
15 |
Correct |
39 ms |
45444 KB |
Output is correct |
16 |
Correct |
135 ms |
66748 KB |
Output is correct |
17 |
Correct |
66 ms |
30460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9716 KB |
Output is correct |
2 |
Correct |
164 ms |
37416 KB |
Output is correct |
3 |
Correct |
255 ms |
48832 KB |
Output is correct |
4 |
Correct |
190 ms |
43556 KB |
Output is correct |
5 |
Correct |
394 ms |
61752 KB |
Output is correct |
6 |
Correct |
350 ms |
61484 KB |
Output is correct |
7 |
Correct |
401 ms |
61196 KB |
Output is correct |
8 |
Correct |
369 ms |
61040 KB |
Output is correct |
9 |
Correct |
420 ms |
61848 KB |
Output is correct |
10 |
Correct |
393 ms |
61720 KB |
Output is correct |
11 |
Correct |
341 ms |
61168 KB |
Output is correct |
12 |
Correct |
331 ms |
61524 KB |
Output is correct |
13 |
Correct |
340 ms |
61768 KB |
Output is correct |
14 |
Correct |
344 ms |
62972 KB |
Output is correct |
15 |
Correct |
385 ms |
66804 KB |
Output is correct |
16 |
Correct |
328 ms |
60952 KB |
Output is correct |
17 |
Correct |
339 ms |
61784 KB |
Output is correct |
18 |
Correct |
348 ms |
61220 KB |
Output is correct |
19 |
Correct |
321 ms |
56780 KB |
Output is correct |
20 |
Correct |
292 ms |
56676 KB |
Output is correct |
21 |
Correct |
325 ms |
57548 KB |
Output is correct |
22 |
Correct |
281 ms |
56956 KB |
Output is correct |
23 |
Correct |
288 ms |
56296 KB |
Output is correct |
24 |
Correct |
338 ms |
56388 KB |
Output is correct |
25 |
Correct |
307 ms |
56788 KB |
Output is correct |
26 |
Correct |
289 ms |
56860 KB |
Output is correct |
27 |
Correct |
312 ms |
56828 KB |
Output is correct |
28 |
Correct |
304 ms |
56760 KB |
Output is correct |
29 |
Correct |
298 ms |
57152 KB |
Output is correct |
30 |
Correct |
299 ms |
57468 KB |
Output is correct |
31 |
Correct |
297 ms |
57388 KB |
Output is correct |
32 |
Correct |
332 ms |
58144 KB |
Output is correct |
33 |
Correct |
333 ms |
60252 KB |
Output is correct |
34 |
Correct |
293 ms |
61028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9712 KB |
Output is correct |
2 |
Correct |
5 ms |
9844 KB |
Output is correct |
3 |
Correct |
6 ms |
10188 KB |
Output is correct |
4 |
Correct |
387 ms |
60628 KB |
Output is correct |
5 |
Correct |
409 ms |
62316 KB |
Output is correct |
6 |
Correct |
459 ms |
71616 KB |
Output is correct |
7 |
Correct |
483 ms |
75744 KB |
Output is correct |
8 |
Correct |
468 ms |
75828 KB |
Output is correct |
9 |
Correct |
472 ms |
75800 KB |
Output is correct |
10 |
Correct |
477 ms |
75832 KB |
Output is correct |
11 |
Correct |
473 ms |
75768 KB |
Output is correct |
12 |
Correct |
461 ms |
75832 KB |
Output is correct |
13 |
Correct |
500 ms |
75816 KB |
Output is correct |
14 |
Correct |
71 ms |
30428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
9684 KB |
Output is correct |
2 |
Correct |
5 ms |
9684 KB |
Output is correct |
3 |
Correct |
4 ms |
9684 KB |
Output is correct |
4 |
Correct |
5 ms |
9844 KB |
Output is correct |
5 |
Correct |
5 ms |
9812 KB |
Output is correct |
6 |
Correct |
5 ms |
9868 KB |
Output is correct |
7 |
Correct |
5 ms |
9840 KB |
Output is correct |
8 |
Correct |
5 ms |
9812 KB |
Output is correct |
9 |
Correct |
5 ms |
9940 KB |
Output is correct |
10 |
Correct |
6 ms |
9916 KB |
Output is correct |
11 |
Correct |
6 ms |
9940 KB |
Output is correct |
12 |
Correct |
5 ms |
9940 KB |
Output is correct |
13 |
Correct |
7 ms |
9900 KB |
Output is correct |
14 |
Correct |
5 ms |
9940 KB |
Output is correct |
15 |
Correct |
5 ms |
9848 KB |
Output is correct |
16 |
Correct |
5 ms |
9844 KB |
Output is correct |
17 |
Correct |
5 ms |
9940 KB |
Output is correct |
18 |
Correct |
5 ms |
9940 KB |
Output is correct |
19 |
Correct |
5 ms |
9940 KB |
Output is correct |
20 |
Correct |
5 ms |
9940 KB |
Output is correct |
21 |
Correct |
5 ms |
9940 KB |
Output is correct |
22 |
Correct |
5 ms |
9940 KB |
Output is correct |
23 |
Correct |
5 ms |
9844 KB |
Output is correct |
24 |
Correct |
5 ms |
9940 KB |
Output is correct |
25 |
Correct |
5 ms |
9848 KB |
Output is correct |
26 |
Correct |
5 ms |
9940 KB |
Output is correct |
27 |
Correct |
5 ms |
9844 KB |
Output is correct |
28 |
Correct |
5 ms |
9812 KB |
Output is correct |
29 |
Correct |
5 ms |
9940 KB |
Output is correct |
30 |
Correct |
7 ms |
10452 KB |
Output is correct |
31 |
Correct |
7 ms |
10580 KB |
Output is correct |
32 |
Correct |
8 ms |
10708 KB |
Output is correct |
33 |
Correct |
11 ms |
10648 KB |
Output is correct |
34 |
Correct |
7 ms |
10648 KB |
Output is correct |
35 |
Correct |
8 ms |
10648 KB |
Output is correct |
36 |
Correct |
8 ms |
10732 KB |
Output is correct |
37 |
Correct |
8 ms |
10656 KB |
Output is correct |
38 |
Correct |
7 ms |
10836 KB |
Output is correct |
39 |
Correct |
7 ms |
10708 KB |
Output is correct |
40 |
Correct |
7 ms |
10780 KB |
Output is correct |
41 |
Correct |
6 ms |
10836 KB |
Output is correct |
42 |
Correct |
7 ms |
10780 KB |
Output is correct |
43 |
Correct |
7 ms |
10780 KB |
Output is correct |
44 |
Correct |
7 ms |
10708 KB |
Output is correct |
45 |
Correct |
7 ms |
10708 KB |
Output is correct |
46 |
Correct |
7 ms |
10708 KB |
Output is correct |
47 |
Correct |
7 ms |
10708 KB |
Output is correct |
48 |
Correct |
7 ms |
10708 KB |
Output is correct |
49 |
Correct |
8 ms |
10708 KB |
Output is correct |
50 |
Correct |
6 ms |
10580 KB |
Output is correct |
51 |
Correct |
7 ms |
10580 KB |
Output is correct |
52 |
Correct |
8 ms |
10708 KB |
Output is correct |
53 |
Correct |
7 ms |
10580 KB |
Output is correct |
54 |
Correct |
7 ms |
10604 KB |
Output is correct |
55 |
Correct |
7 ms |
10656 KB |
Output is correct |
56 |
Correct |
6 ms |
10092 KB |
Output is correct |
57 |
Correct |
6 ms |
10128 KB |
Output is correct |
58 |
Correct |
8 ms |
10652 KB |
Output is correct |
59 |
Correct |
5 ms |
9684 KB |
Output is correct |
60 |
Correct |
5 ms |
9844 KB |
Output is correct |
61 |
Correct |
5 ms |
10120 KB |
Output is correct |
62 |
Correct |
125 ms |
48072 KB |
Output is correct |
63 |
Correct |
87 ms |
50576 KB |
Output is correct |
64 |
Correct |
109 ms |
59104 KB |
Output is correct |
65 |
Correct |
140 ms |
66968 KB |
Output is correct |
66 |
Correct |
138 ms |
66960 KB |
Output is correct |
67 |
Correct |
142 ms |
67012 KB |
Output is correct |
68 |
Correct |
143 ms |
67092 KB |
Output is correct |
69 |
Correct |
145 ms |
67040 KB |
Output is correct |
70 |
Correct |
103 ms |
65876 KB |
Output is correct |
71 |
Correct |
111 ms |
65820 KB |
Output is correct |
72 |
Correct |
98 ms |
65844 KB |
Output is correct |
73 |
Correct |
39 ms |
45444 KB |
Output is correct |
74 |
Correct |
135 ms |
66748 KB |
Output is correct |
75 |
Correct |
66 ms |
30460 KB |
Output is correct |
76 |
Correct |
4 ms |
9716 KB |
Output is correct |
77 |
Correct |
164 ms |
37416 KB |
Output is correct |
78 |
Correct |
255 ms |
48832 KB |
Output is correct |
79 |
Correct |
190 ms |
43556 KB |
Output is correct |
80 |
Correct |
394 ms |
61752 KB |
Output is correct |
81 |
Correct |
350 ms |
61484 KB |
Output is correct |
82 |
Correct |
401 ms |
61196 KB |
Output is correct |
83 |
Correct |
369 ms |
61040 KB |
Output is correct |
84 |
Correct |
420 ms |
61848 KB |
Output is correct |
85 |
Correct |
393 ms |
61720 KB |
Output is correct |
86 |
Correct |
341 ms |
61168 KB |
Output is correct |
87 |
Correct |
331 ms |
61524 KB |
Output is correct |
88 |
Correct |
340 ms |
61768 KB |
Output is correct |
89 |
Correct |
344 ms |
62972 KB |
Output is correct |
90 |
Correct |
385 ms |
66804 KB |
Output is correct |
91 |
Correct |
328 ms |
60952 KB |
Output is correct |
92 |
Correct |
339 ms |
61784 KB |
Output is correct |
93 |
Correct |
348 ms |
61220 KB |
Output is correct |
94 |
Correct |
321 ms |
56780 KB |
Output is correct |
95 |
Correct |
292 ms |
56676 KB |
Output is correct |
96 |
Correct |
325 ms |
57548 KB |
Output is correct |
97 |
Correct |
281 ms |
56956 KB |
Output is correct |
98 |
Correct |
288 ms |
56296 KB |
Output is correct |
99 |
Correct |
338 ms |
56388 KB |
Output is correct |
100 |
Correct |
307 ms |
56788 KB |
Output is correct |
101 |
Correct |
289 ms |
56860 KB |
Output is correct |
102 |
Correct |
312 ms |
56828 KB |
Output is correct |
103 |
Correct |
304 ms |
56760 KB |
Output is correct |
104 |
Correct |
298 ms |
57152 KB |
Output is correct |
105 |
Correct |
299 ms |
57468 KB |
Output is correct |
106 |
Correct |
297 ms |
57388 KB |
Output is correct |
107 |
Correct |
332 ms |
58144 KB |
Output is correct |
108 |
Correct |
333 ms |
60252 KB |
Output is correct |
109 |
Correct |
293 ms |
61028 KB |
Output is correct |
110 |
Correct |
4 ms |
9712 KB |
Output is correct |
111 |
Correct |
5 ms |
9844 KB |
Output is correct |
112 |
Correct |
6 ms |
10188 KB |
Output is correct |
113 |
Correct |
387 ms |
60628 KB |
Output is correct |
114 |
Correct |
409 ms |
62316 KB |
Output is correct |
115 |
Correct |
459 ms |
71616 KB |
Output is correct |
116 |
Correct |
483 ms |
75744 KB |
Output is correct |
117 |
Correct |
468 ms |
75828 KB |
Output is correct |
118 |
Correct |
472 ms |
75800 KB |
Output is correct |
119 |
Correct |
477 ms |
75832 KB |
Output is correct |
120 |
Correct |
473 ms |
75768 KB |
Output is correct |
121 |
Correct |
461 ms |
75832 KB |
Output is correct |
122 |
Correct |
500 ms |
75816 KB |
Output is correct |
123 |
Correct |
71 ms |
30428 KB |
Output is correct |
124 |
Correct |
316 ms |
59856 KB |
Output is correct |
125 |
Correct |
229 ms |
51540 KB |
Output is correct |
126 |
Correct |
381 ms |
65960 KB |
Output is correct |
127 |
Correct |
420 ms |
66180 KB |
Output is correct |
128 |
Correct |
400 ms |
66108 KB |
Output is correct |
129 |
Correct |
382 ms |
65896 KB |
Output is correct |
130 |
Correct |
368 ms |
65132 KB |
Output is correct |
131 |
Correct |
177 ms |
65640 KB |
Output is correct |
132 |
Correct |
177 ms |
66856 KB |
Output is correct |
133 |
Correct |
219 ms |
61672 KB |
Output is correct |
134 |
Correct |
298 ms |
60448 KB |
Output is correct |
135 |
Correct |
328 ms |
61204 KB |
Output is correct |
136 |
Correct |
321 ms |
60956 KB |
Output is correct |
137 |
Correct |
163 ms |
55556 KB |
Output is correct |
138 |
Correct |
177 ms |
55540 KB |
Output is correct |
139 |
Correct |
180 ms |
55736 KB |
Output is correct |
140 |
Correct |
180 ms |
55504 KB |
Output is correct |
141 |
Correct |
166 ms |
55488 KB |
Output is correct |
142 |
Correct |
180 ms |
55564 KB |
Output is correct |
143 |
Correct |
54 ms |
31400 KB |
Output is correct |
144 |
Correct |
365 ms |
65400 KB |
Output is correct |