#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int n, m;
vector<int> tree[200006], child[200006];
vector<pair<int, int>> adj[200006];
int _par[200006], _sz[200006];
int dfs(int x, int prev = -1) {
_par[x] = prev;
_sz[x] = 1;
for (auto &i: tree[x]) if (i != prev) {
_sz[x] = max(_sz[x], dfs(i, x) + 1);
}
return _sz[x];
}
int dist[200006];
int dfs_dist(int x, int prev = -1) {
vector<int> v;
int ret = 0;
dist[x] = 0;
for (auto &i: tree[x]) if (i != prev) {
v.push_back(dfs_dist(i, x) + 1);
ret = max(ret, v.back());
dist[x] = max(dist[x], dist[i]);
}
int v0 = max_element(v.begin(), v.end()) - v.begin();
int X = v[v0];
if (!v.empty()) v[v0] = 0;
int v1 = max_element(v.begin(), v.end()) - v.begin();
v[v0] = X;
if (!v.empty()) dist[x] = max(dist[x], v[v0]);
if ((int)v.size() > 1) dist[x] = max(dist[x], v[v0] + v[v1]);
return ret;
}
int sz[200006], depth[200006], par[200006];
int in[200006], top[100006], T;
void dfs_child(int x, int prev = -1) {
par[x] = prev;
for (auto &i: tree[x]) if (i != prev) {
child[x].push_back(i);
dfs_child(i, x);
}
}
int dfs_sz(int x) {
sz[x] = 1;
for (auto &i: child[x]) {
depth[i] = depth[x] + 1;
sz[x] += dfs_sz(i);
if (sz[i] > sz[child[x][0]]) swap(child[x][0], i);
}
return sz[x];
}
void dfs_hld(int x) {
in[x] = T++;
for (auto &i: child[x]) {
top[i] = (i == child[x][0] ? top[x] : i);
dfs_hld(i);
}
}
int get_dist(int u, int v) {
int ret = 0;
while (top[u] != top[v]) {
if (depth[top[u]] < depth[top[v]]) swap(u, v);
ret += depth[u] - depth[par[top[u]]];
u = par[top[u]];
}
return ret + abs(depth[u] - depth[v]);
}
int main() {
scanf("%d%d", &n, &m);
while (m--) {
int x, y, w;
scanf("%d%d%d", &x, &y, &w);
if (w == 1) {
tree[x].push_back(y);
tree[y].push_back(x);
} else {
adj[x].push_back({ y, w });
adj[y].push_back({ x, w });
}
}
dfs_child(0);
dfs_sz(0);
dfs_hld(0);
dfs_dist(0);
int zero = 2 * (n - 1) - dist[0], one = (int)1e9;
for (int i = 0; i < n; i++) {
dfs(i);
dfs_dist(i);
for (auto &j: adj[i]) if (i < j.first) {
int curr = j.second + 2 * (n - 1) - get_dist(i, j.first) - 1;
int x = j.first, pv = -1;
vector<pair<int, int>> v;
int y = -1, T = 0;
while (x != -1) {
for (auto &k: tree[x]) if (k != pv && k != _par[x]) {
if (_sz[k]) {
if (!v.empty() && v.back().second == T) {
y = max(y, v.back().first + _sz[k] - 1);
v.back().first = max(v.back().first, _sz[k]);
} else v.push_back({ _sz[k], T });
}
y = max(y, dist[k] - 1);
}
T++;
pv = x;
x = _par[x];
}
int ans = -(int)1e9;
for (int i = 0; i < (int)v.size(); i++) {
if (i) ans -= v[i].second - v[i - 1].second;
y = max(y, ans + v[i].first + 1);
ans = max(ans, v[i].first);
}
curr -= y;
one = min(one, curr);
}
}
printf("%d", min(zero, one));
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:82:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
82 | scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:85:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
85 | scanf("%d%d%d", &x, &y, &w);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2164 ms |
15640 KB |
Output is correct |
2 |
Correct |
2156 ms |
15684 KB |
Output is correct |
3 |
Correct |
2137 ms |
15412 KB |
Output is correct |
4 |
Correct |
1955 ms |
15428 KB |
Output is correct |
5 |
Correct |
1884 ms |
15240 KB |
Output is correct |
6 |
Correct |
643 ms |
14988 KB |
Output is correct |
7 |
Correct |
2156 ms |
15616 KB |
Output is correct |
8 |
Correct |
2387 ms |
15396 KB |
Output is correct |
9 |
Correct |
2223 ms |
15544 KB |
Output is correct |
10 |
Correct |
1890 ms |
15328 KB |
Output is correct |
11 |
Correct |
1894 ms |
15408 KB |
Output is correct |
12 |
Correct |
1874 ms |
15424 KB |
Output is correct |
13 |
Correct |
1988 ms |
15412 KB |
Output is correct |
14 |
Correct |
1908 ms |
15408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
36 |
Correct |
8 ms |
14412 KB |
Output is correct |
37 |
Correct |
8 ms |
14412 KB |
Output is correct |
38 |
Correct |
8 ms |
14412 KB |
Output is correct |
39 |
Correct |
8 ms |
14412 KB |
Output is correct |
40 |
Correct |
8 ms |
14412 KB |
Output is correct |
41 |
Correct |
8 ms |
14412 KB |
Output is correct |
42 |
Correct |
8 ms |
14352 KB |
Output is correct |
43 |
Correct |
8 ms |
14368 KB |
Output is correct |
44 |
Correct |
8 ms |
14412 KB |
Output is correct |
45 |
Correct |
8 ms |
14412 KB |
Output is correct |
46 |
Correct |
8 ms |
14412 KB |
Output is correct |
47 |
Correct |
8 ms |
14412 KB |
Output is correct |
48 |
Correct |
7 ms |
14412 KB |
Output is correct |
49 |
Correct |
8 ms |
14412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
36 |
Correct |
8 ms |
14412 KB |
Output is correct |
37 |
Correct |
8 ms |
14412 KB |
Output is correct |
38 |
Correct |
8 ms |
14412 KB |
Output is correct |
39 |
Correct |
8 ms |
14412 KB |
Output is correct |
40 |
Correct |
8 ms |
14412 KB |
Output is correct |
41 |
Correct |
8 ms |
14412 KB |
Output is correct |
42 |
Correct |
8 ms |
14352 KB |
Output is correct |
43 |
Correct |
8 ms |
14368 KB |
Output is correct |
44 |
Correct |
8 ms |
14412 KB |
Output is correct |
45 |
Correct |
8 ms |
14412 KB |
Output is correct |
46 |
Correct |
8 ms |
14412 KB |
Output is correct |
47 |
Correct |
8 ms |
14412 KB |
Output is correct |
48 |
Correct |
7 ms |
14412 KB |
Output is correct |
49 |
Correct |
8 ms |
14412 KB |
Output is correct |
50 |
Correct |
23 ms |
14412 KB |
Output is correct |
51 |
Correct |
24 ms |
14524 KB |
Output is correct |
52 |
Correct |
23 ms |
14412 KB |
Output is correct |
53 |
Correct |
22 ms |
14496 KB |
Output is correct |
54 |
Correct |
22 ms |
14412 KB |
Output is correct |
55 |
Correct |
14 ms |
14412 KB |
Output is correct |
56 |
Correct |
23 ms |
14412 KB |
Output is correct |
57 |
Correct |
24 ms |
14512 KB |
Output is correct |
58 |
Correct |
24 ms |
14516 KB |
Output is correct |
59 |
Correct |
22 ms |
14500 KB |
Output is correct |
60 |
Correct |
22 ms |
14504 KB |
Output is correct |
61 |
Correct |
22 ms |
14500 KB |
Output is correct |
62 |
Correct |
23 ms |
14412 KB |
Output is correct |
63 |
Correct |
21 ms |
14412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
36 |
Correct |
2164 ms |
15640 KB |
Output is correct |
37 |
Correct |
2156 ms |
15684 KB |
Output is correct |
38 |
Correct |
2137 ms |
15412 KB |
Output is correct |
39 |
Correct |
1955 ms |
15428 KB |
Output is correct |
40 |
Correct |
1884 ms |
15240 KB |
Output is correct |
41 |
Correct |
643 ms |
14988 KB |
Output is correct |
42 |
Correct |
2156 ms |
15616 KB |
Output is correct |
43 |
Correct |
2387 ms |
15396 KB |
Output is correct |
44 |
Correct |
2223 ms |
15544 KB |
Output is correct |
45 |
Correct |
1890 ms |
15328 KB |
Output is correct |
46 |
Correct |
1894 ms |
15408 KB |
Output is correct |
47 |
Correct |
1874 ms |
15424 KB |
Output is correct |
48 |
Correct |
1988 ms |
15412 KB |
Output is correct |
49 |
Correct |
1908 ms |
15408 KB |
Output is correct |
50 |
Correct |
8 ms |
14412 KB |
Output is correct |
51 |
Correct |
8 ms |
14412 KB |
Output is correct |
52 |
Correct |
8 ms |
14412 KB |
Output is correct |
53 |
Correct |
8 ms |
14412 KB |
Output is correct |
54 |
Correct |
8 ms |
14412 KB |
Output is correct |
55 |
Correct |
8 ms |
14412 KB |
Output is correct |
56 |
Correct |
8 ms |
14352 KB |
Output is correct |
57 |
Correct |
8 ms |
14368 KB |
Output is correct |
58 |
Correct |
8 ms |
14412 KB |
Output is correct |
59 |
Correct |
8 ms |
14412 KB |
Output is correct |
60 |
Correct |
8 ms |
14412 KB |
Output is correct |
61 |
Correct |
8 ms |
14412 KB |
Output is correct |
62 |
Correct |
7 ms |
14412 KB |
Output is correct |
63 |
Correct |
8 ms |
14412 KB |
Output is correct |
64 |
Correct |
23 ms |
14412 KB |
Output is correct |
65 |
Correct |
24 ms |
14524 KB |
Output is correct |
66 |
Correct |
23 ms |
14412 KB |
Output is correct |
67 |
Correct |
22 ms |
14496 KB |
Output is correct |
68 |
Correct |
22 ms |
14412 KB |
Output is correct |
69 |
Correct |
14 ms |
14412 KB |
Output is correct |
70 |
Correct |
23 ms |
14412 KB |
Output is correct |
71 |
Correct |
24 ms |
14512 KB |
Output is correct |
72 |
Correct |
24 ms |
14516 KB |
Output is correct |
73 |
Correct |
22 ms |
14500 KB |
Output is correct |
74 |
Correct |
22 ms |
14504 KB |
Output is correct |
75 |
Correct |
22 ms |
14500 KB |
Output is correct |
76 |
Correct |
23 ms |
14412 KB |
Output is correct |
77 |
Correct |
21 ms |
14412 KB |
Output is correct |
78 |
Correct |
2094 ms |
15648 KB |
Output is correct |
79 |
Correct |
2144 ms |
15632 KB |
Output is correct |
80 |
Correct |
2040 ms |
15436 KB |
Output is correct |
81 |
Correct |
1976 ms |
15316 KB |
Output is correct |
82 |
Correct |
1931 ms |
15244 KB |
Output is correct |
83 |
Correct |
627 ms |
14924 KB |
Output is correct |
84 |
Correct |
2084 ms |
15684 KB |
Output is correct |
85 |
Correct |
2407 ms |
15424 KB |
Output is correct |
86 |
Correct |
2235 ms |
15556 KB |
Output is correct |
87 |
Correct |
1956 ms |
15320 KB |
Output is correct |
88 |
Correct |
2013 ms |
15432 KB |
Output is correct |
89 |
Correct |
1923 ms |
15308 KB |
Output is correct |
90 |
Correct |
1765 ms |
15212 KB |
Output is correct |
91 |
Correct |
1816 ms |
15212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
36 |
Correct |
2164 ms |
15640 KB |
Output is correct |
37 |
Correct |
2156 ms |
15684 KB |
Output is correct |
38 |
Correct |
2137 ms |
15412 KB |
Output is correct |
39 |
Correct |
1955 ms |
15428 KB |
Output is correct |
40 |
Correct |
1884 ms |
15240 KB |
Output is correct |
41 |
Correct |
643 ms |
14988 KB |
Output is correct |
42 |
Correct |
2156 ms |
15616 KB |
Output is correct |
43 |
Correct |
2387 ms |
15396 KB |
Output is correct |
44 |
Correct |
2223 ms |
15544 KB |
Output is correct |
45 |
Correct |
1890 ms |
15328 KB |
Output is correct |
46 |
Correct |
1894 ms |
15408 KB |
Output is correct |
47 |
Correct |
1874 ms |
15424 KB |
Output is correct |
48 |
Correct |
1988 ms |
15412 KB |
Output is correct |
49 |
Correct |
1908 ms |
15408 KB |
Output is correct |
50 |
Correct |
8 ms |
14412 KB |
Output is correct |
51 |
Correct |
8 ms |
14412 KB |
Output is correct |
52 |
Correct |
8 ms |
14412 KB |
Output is correct |
53 |
Correct |
8 ms |
14412 KB |
Output is correct |
54 |
Correct |
8 ms |
14412 KB |
Output is correct |
55 |
Correct |
8 ms |
14412 KB |
Output is correct |
56 |
Correct |
8 ms |
14352 KB |
Output is correct |
57 |
Correct |
8 ms |
14368 KB |
Output is correct |
58 |
Correct |
8 ms |
14412 KB |
Output is correct |
59 |
Correct |
8 ms |
14412 KB |
Output is correct |
60 |
Correct |
8 ms |
14412 KB |
Output is correct |
61 |
Correct |
8 ms |
14412 KB |
Output is correct |
62 |
Correct |
7 ms |
14412 KB |
Output is correct |
63 |
Correct |
8 ms |
14412 KB |
Output is correct |
64 |
Correct |
23 ms |
14412 KB |
Output is correct |
65 |
Correct |
24 ms |
14524 KB |
Output is correct |
66 |
Correct |
23 ms |
14412 KB |
Output is correct |
67 |
Correct |
22 ms |
14496 KB |
Output is correct |
68 |
Correct |
22 ms |
14412 KB |
Output is correct |
69 |
Correct |
14 ms |
14412 KB |
Output is correct |
70 |
Correct |
23 ms |
14412 KB |
Output is correct |
71 |
Correct |
24 ms |
14512 KB |
Output is correct |
72 |
Correct |
24 ms |
14516 KB |
Output is correct |
73 |
Correct |
22 ms |
14500 KB |
Output is correct |
74 |
Correct |
22 ms |
14504 KB |
Output is correct |
75 |
Correct |
22 ms |
14500 KB |
Output is correct |
76 |
Correct |
23 ms |
14412 KB |
Output is correct |
77 |
Correct |
21 ms |
14412 KB |
Output is correct |
78 |
Correct |
2094 ms |
15648 KB |
Output is correct |
79 |
Correct |
2144 ms |
15632 KB |
Output is correct |
80 |
Correct |
2040 ms |
15436 KB |
Output is correct |
81 |
Correct |
1976 ms |
15316 KB |
Output is correct |
82 |
Correct |
1931 ms |
15244 KB |
Output is correct |
83 |
Correct |
627 ms |
14924 KB |
Output is correct |
84 |
Correct |
2084 ms |
15684 KB |
Output is correct |
85 |
Correct |
2407 ms |
15424 KB |
Output is correct |
86 |
Correct |
2235 ms |
15556 KB |
Output is correct |
87 |
Correct |
1956 ms |
15320 KB |
Output is correct |
88 |
Correct |
2013 ms |
15432 KB |
Output is correct |
89 |
Correct |
1923 ms |
15308 KB |
Output is correct |
90 |
Correct |
1765 ms |
15212 KB |
Output is correct |
91 |
Correct |
1816 ms |
15212 KB |
Output is correct |
92 |
Execution timed out |
7030 ms |
29100 KB |
Time limit exceeded |
93 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14336 KB |
Output is correct |
2 |
Correct |
8 ms |
14416 KB |
Output is correct |
3 |
Correct |
8 ms |
14412 KB |
Output is correct |
4 |
Correct |
9 ms |
14412 KB |
Output is correct |
5 |
Correct |
9 ms |
14412 KB |
Output is correct |
6 |
Correct |
8 ms |
14356 KB |
Output is correct |
7 |
Correct |
9 ms |
14412 KB |
Output is correct |
8 |
Correct |
8 ms |
14412 KB |
Output is correct |
9 |
Correct |
8 ms |
14412 KB |
Output is correct |
10 |
Correct |
7 ms |
14412 KB |
Output is correct |
11 |
Correct |
7 ms |
14412 KB |
Output is correct |
12 |
Correct |
7 ms |
14412 KB |
Output is correct |
13 |
Correct |
7 ms |
14412 KB |
Output is correct |
14 |
Correct |
8 ms |
14412 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
7 ms |
14292 KB |
Output is correct |
18 |
Correct |
7 ms |
14292 KB |
Output is correct |
19 |
Correct |
9 ms |
14412 KB |
Output is correct |
20 |
Correct |
7 ms |
14420 KB |
Output is correct |
21 |
Correct |
7 ms |
14420 KB |
Output is correct |
22 |
Correct |
7 ms |
14412 KB |
Output is correct |
23 |
Correct |
7 ms |
14412 KB |
Output is correct |
24 |
Correct |
7 ms |
14412 KB |
Output is correct |
25 |
Correct |
7 ms |
14412 KB |
Output is correct |
26 |
Correct |
8 ms |
14412 KB |
Output is correct |
27 |
Correct |
8 ms |
14412 KB |
Output is correct |
28 |
Correct |
8 ms |
14412 KB |
Output is correct |
29 |
Correct |
9 ms |
14412 KB |
Output is correct |
30 |
Correct |
8 ms |
14412 KB |
Output is correct |
31 |
Correct |
8 ms |
14412 KB |
Output is correct |
32 |
Correct |
9 ms |
14412 KB |
Output is correct |
33 |
Correct |
7 ms |
14376 KB |
Output is correct |
34 |
Correct |
7 ms |
14356 KB |
Output is correct |
35 |
Correct |
8 ms |
14412 KB |
Output is correct |
36 |
Correct |
2164 ms |
15640 KB |
Output is correct |
37 |
Correct |
2156 ms |
15684 KB |
Output is correct |
38 |
Correct |
2137 ms |
15412 KB |
Output is correct |
39 |
Correct |
1955 ms |
15428 KB |
Output is correct |
40 |
Correct |
1884 ms |
15240 KB |
Output is correct |
41 |
Correct |
643 ms |
14988 KB |
Output is correct |
42 |
Correct |
2156 ms |
15616 KB |
Output is correct |
43 |
Correct |
2387 ms |
15396 KB |
Output is correct |
44 |
Correct |
2223 ms |
15544 KB |
Output is correct |
45 |
Correct |
1890 ms |
15328 KB |
Output is correct |
46 |
Correct |
1894 ms |
15408 KB |
Output is correct |
47 |
Correct |
1874 ms |
15424 KB |
Output is correct |
48 |
Correct |
1988 ms |
15412 KB |
Output is correct |
49 |
Correct |
1908 ms |
15408 KB |
Output is correct |
50 |
Correct |
8 ms |
14412 KB |
Output is correct |
51 |
Correct |
8 ms |
14412 KB |
Output is correct |
52 |
Correct |
8 ms |
14412 KB |
Output is correct |
53 |
Correct |
8 ms |
14412 KB |
Output is correct |
54 |
Correct |
8 ms |
14412 KB |
Output is correct |
55 |
Correct |
8 ms |
14412 KB |
Output is correct |
56 |
Correct |
8 ms |
14352 KB |
Output is correct |
57 |
Correct |
8 ms |
14368 KB |
Output is correct |
58 |
Correct |
8 ms |
14412 KB |
Output is correct |
59 |
Correct |
8 ms |
14412 KB |
Output is correct |
60 |
Correct |
8 ms |
14412 KB |
Output is correct |
61 |
Correct |
8 ms |
14412 KB |
Output is correct |
62 |
Correct |
7 ms |
14412 KB |
Output is correct |
63 |
Correct |
8 ms |
14412 KB |
Output is correct |
64 |
Correct |
23 ms |
14412 KB |
Output is correct |
65 |
Correct |
24 ms |
14524 KB |
Output is correct |
66 |
Correct |
23 ms |
14412 KB |
Output is correct |
67 |
Correct |
22 ms |
14496 KB |
Output is correct |
68 |
Correct |
22 ms |
14412 KB |
Output is correct |
69 |
Correct |
14 ms |
14412 KB |
Output is correct |
70 |
Correct |
23 ms |
14412 KB |
Output is correct |
71 |
Correct |
24 ms |
14512 KB |
Output is correct |
72 |
Correct |
24 ms |
14516 KB |
Output is correct |
73 |
Correct |
22 ms |
14500 KB |
Output is correct |
74 |
Correct |
22 ms |
14504 KB |
Output is correct |
75 |
Correct |
22 ms |
14500 KB |
Output is correct |
76 |
Correct |
23 ms |
14412 KB |
Output is correct |
77 |
Correct |
21 ms |
14412 KB |
Output is correct |
78 |
Correct |
2094 ms |
15648 KB |
Output is correct |
79 |
Correct |
2144 ms |
15632 KB |
Output is correct |
80 |
Correct |
2040 ms |
15436 KB |
Output is correct |
81 |
Correct |
1976 ms |
15316 KB |
Output is correct |
82 |
Correct |
1931 ms |
15244 KB |
Output is correct |
83 |
Correct |
627 ms |
14924 KB |
Output is correct |
84 |
Correct |
2084 ms |
15684 KB |
Output is correct |
85 |
Correct |
2407 ms |
15424 KB |
Output is correct |
86 |
Correct |
2235 ms |
15556 KB |
Output is correct |
87 |
Correct |
1956 ms |
15320 KB |
Output is correct |
88 |
Correct |
2013 ms |
15432 KB |
Output is correct |
89 |
Correct |
1923 ms |
15308 KB |
Output is correct |
90 |
Correct |
1765 ms |
15212 KB |
Output is correct |
91 |
Correct |
1816 ms |
15212 KB |
Output is correct |
92 |
Execution timed out |
7030 ms |
29100 KB |
Time limit exceeded |
93 |
Halted |
0 ms |
0 KB |
- |