#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int n, m;
vector<int> tree[200006];
vector<pair<int, int>> adj[200006];
int par[200006], sz[200006];
bool cl[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 sp[18][200006], depth[200006];
void dfs_depth(int x, int prev = -1) {
par[x] = prev;
for (auto &i: tree[x]) if (i != prev) {
depth[i] = depth[x] + 1;
dfs_depth(i, x);
}
}
int get_dist(int u, int v) {
if (depth[u] < depth[v]) swap(u, v);
int diff = depth[u] - depth[v], ret = diff;
for (int t = 17; t >= 0; t--) if (diff >= 1 << t) {
diff -= 1 << t;
u = sp[t][u];
}
if (u == v) return ret;
for (int t = 17; t >= 0; t--) if (sp[t][u] != -1 && sp[t][v] != -1 && sp[t][u] != sp[t][v]) {
ret += 1 << t + 1;
u = sp[t][u], v = sp[t][v];
}
return ret + 2;
}
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_dist(0);
dfs_depth(0);
for (int i = 0; i < n; i++) sp[0][i] = par[i];
for (int t = 1; t < 18; t++) for (int i = 0; i < n; i++) {
if (sp[t - 1][i] == -1) sp[t][i] = -1;
else sp[t][i] = sp[t - 1][sp[t - 1][i]];
}
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 get_dist(int, int)':
Main.cpp:62:23: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
62 | ret += 1 << t + 1;
| ~~^~~
Main.cpp: In function 'int main()':
Main.cpp:69:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
69 | scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:72:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
72 | scanf("%d%d%d", &x, &y, &w);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2114 ms |
11140 KB |
Output is correct |
2 |
Correct |
2229 ms |
11128 KB |
Output is correct |
3 |
Correct |
2057 ms |
10912 KB |
Output is correct |
4 |
Correct |
1938 ms |
10812 KB |
Output is correct |
5 |
Correct |
1882 ms |
10752 KB |
Output is correct |
6 |
Correct |
616 ms |
10572 KB |
Output is correct |
7 |
Correct |
2133 ms |
11212 KB |
Output is correct |
8 |
Correct |
2439 ms |
10936 KB |
Output is correct |
9 |
Correct |
2236 ms |
11084 KB |
Output is correct |
10 |
Correct |
1931 ms |
10808 KB |
Output is correct |
11 |
Correct |
1944 ms |
10916 KB |
Output is correct |
12 |
Correct |
1864 ms |
10936 KB |
Output is correct |
13 |
Correct |
1958 ms |
10912 KB |
Output is correct |
14 |
Correct |
1908 ms |
10912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
36 |
Correct |
5 ms |
9804 KB |
Output is correct |
37 |
Correct |
5 ms |
9804 KB |
Output is correct |
38 |
Correct |
5 ms |
9804 KB |
Output is correct |
39 |
Correct |
5 ms |
9812 KB |
Output is correct |
40 |
Correct |
6 ms |
9808 KB |
Output is correct |
41 |
Correct |
6 ms |
9804 KB |
Output is correct |
42 |
Correct |
5 ms |
9804 KB |
Output is correct |
43 |
Correct |
6 ms |
9804 KB |
Output is correct |
44 |
Correct |
6 ms |
9804 KB |
Output is correct |
45 |
Correct |
6 ms |
9816 KB |
Output is correct |
46 |
Correct |
6 ms |
9812 KB |
Output is correct |
47 |
Correct |
6 ms |
9804 KB |
Output is correct |
48 |
Correct |
5 ms |
9804 KB |
Output is correct |
49 |
Correct |
5 ms |
9804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
36 |
Correct |
5 ms |
9804 KB |
Output is correct |
37 |
Correct |
5 ms |
9804 KB |
Output is correct |
38 |
Correct |
5 ms |
9804 KB |
Output is correct |
39 |
Correct |
5 ms |
9812 KB |
Output is correct |
40 |
Correct |
6 ms |
9808 KB |
Output is correct |
41 |
Correct |
6 ms |
9804 KB |
Output is correct |
42 |
Correct |
5 ms |
9804 KB |
Output is correct |
43 |
Correct |
6 ms |
9804 KB |
Output is correct |
44 |
Correct |
6 ms |
9804 KB |
Output is correct |
45 |
Correct |
6 ms |
9816 KB |
Output is correct |
46 |
Correct |
6 ms |
9812 KB |
Output is correct |
47 |
Correct |
6 ms |
9804 KB |
Output is correct |
48 |
Correct |
5 ms |
9804 KB |
Output is correct |
49 |
Correct |
5 ms |
9804 KB |
Output is correct |
50 |
Correct |
20 ms |
9804 KB |
Output is correct |
51 |
Correct |
21 ms |
9924 KB |
Output is correct |
52 |
Correct |
23 ms |
10028 KB |
Output is correct |
53 |
Correct |
20 ms |
9880 KB |
Output is correct |
54 |
Correct |
20 ms |
9884 KB |
Output is correct |
55 |
Correct |
11 ms |
9804 KB |
Output is correct |
56 |
Correct |
23 ms |
9804 KB |
Output is correct |
57 |
Correct |
22 ms |
9904 KB |
Output is correct |
58 |
Correct |
22 ms |
9916 KB |
Output is correct |
59 |
Correct |
20 ms |
9868 KB |
Output is correct |
60 |
Correct |
19 ms |
9896 KB |
Output is correct |
61 |
Correct |
20 ms |
9884 KB |
Output is correct |
62 |
Correct |
18 ms |
9876 KB |
Output is correct |
63 |
Correct |
18 ms |
9876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
36 |
Correct |
2114 ms |
11140 KB |
Output is correct |
37 |
Correct |
2229 ms |
11128 KB |
Output is correct |
38 |
Correct |
2057 ms |
10912 KB |
Output is correct |
39 |
Correct |
1938 ms |
10812 KB |
Output is correct |
40 |
Correct |
1882 ms |
10752 KB |
Output is correct |
41 |
Correct |
616 ms |
10572 KB |
Output is correct |
42 |
Correct |
2133 ms |
11212 KB |
Output is correct |
43 |
Correct |
2439 ms |
10936 KB |
Output is correct |
44 |
Correct |
2236 ms |
11084 KB |
Output is correct |
45 |
Correct |
1931 ms |
10808 KB |
Output is correct |
46 |
Correct |
1944 ms |
10916 KB |
Output is correct |
47 |
Correct |
1864 ms |
10936 KB |
Output is correct |
48 |
Correct |
1958 ms |
10912 KB |
Output is correct |
49 |
Correct |
1908 ms |
10912 KB |
Output is correct |
50 |
Correct |
5 ms |
9804 KB |
Output is correct |
51 |
Correct |
5 ms |
9804 KB |
Output is correct |
52 |
Correct |
5 ms |
9804 KB |
Output is correct |
53 |
Correct |
5 ms |
9812 KB |
Output is correct |
54 |
Correct |
6 ms |
9808 KB |
Output is correct |
55 |
Correct |
6 ms |
9804 KB |
Output is correct |
56 |
Correct |
5 ms |
9804 KB |
Output is correct |
57 |
Correct |
6 ms |
9804 KB |
Output is correct |
58 |
Correct |
6 ms |
9804 KB |
Output is correct |
59 |
Correct |
6 ms |
9816 KB |
Output is correct |
60 |
Correct |
6 ms |
9812 KB |
Output is correct |
61 |
Correct |
6 ms |
9804 KB |
Output is correct |
62 |
Correct |
5 ms |
9804 KB |
Output is correct |
63 |
Correct |
5 ms |
9804 KB |
Output is correct |
64 |
Correct |
20 ms |
9804 KB |
Output is correct |
65 |
Correct |
21 ms |
9924 KB |
Output is correct |
66 |
Correct |
23 ms |
10028 KB |
Output is correct |
67 |
Correct |
20 ms |
9880 KB |
Output is correct |
68 |
Correct |
20 ms |
9884 KB |
Output is correct |
69 |
Correct |
11 ms |
9804 KB |
Output is correct |
70 |
Correct |
23 ms |
9804 KB |
Output is correct |
71 |
Correct |
22 ms |
9904 KB |
Output is correct |
72 |
Correct |
22 ms |
9916 KB |
Output is correct |
73 |
Correct |
20 ms |
9868 KB |
Output is correct |
74 |
Correct |
19 ms |
9896 KB |
Output is correct |
75 |
Correct |
20 ms |
9884 KB |
Output is correct |
76 |
Correct |
18 ms |
9876 KB |
Output is correct |
77 |
Correct |
18 ms |
9876 KB |
Output is correct |
78 |
Correct |
2127 ms |
11216 KB |
Output is correct |
79 |
Correct |
2133 ms |
11132 KB |
Output is correct |
80 |
Correct |
2029 ms |
10920 KB |
Output is correct |
81 |
Correct |
1922 ms |
10808 KB |
Output is correct |
82 |
Correct |
1895 ms |
10820 KB |
Output is correct |
83 |
Correct |
638 ms |
10720 KB |
Output is correct |
84 |
Correct |
2141 ms |
11084 KB |
Output is correct |
85 |
Correct |
2366 ms |
10940 KB |
Output is correct |
86 |
Correct |
2196 ms |
11084 KB |
Output is correct |
87 |
Correct |
1976 ms |
10812 KB |
Output is correct |
88 |
Correct |
1998 ms |
10908 KB |
Output is correct |
89 |
Correct |
1865 ms |
10820 KB |
Output is correct |
90 |
Correct |
1787 ms |
10708 KB |
Output is correct |
91 |
Correct |
1758 ms |
10700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
36 |
Correct |
2114 ms |
11140 KB |
Output is correct |
37 |
Correct |
2229 ms |
11128 KB |
Output is correct |
38 |
Correct |
2057 ms |
10912 KB |
Output is correct |
39 |
Correct |
1938 ms |
10812 KB |
Output is correct |
40 |
Correct |
1882 ms |
10752 KB |
Output is correct |
41 |
Correct |
616 ms |
10572 KB |
Output is correct |
42 |
Correct |
2133 ms |
11212 KB |
Output is correct |
43 |
Correct |
2439 ms |
10936 KB |
Output is correct |
44 |
Correct |
2236 ms |
11084 KB |
Output is correct |
45 |
Correct |
1931 ms |
10808 KB |
Output is correct |
46 |
Correct |
1944 ms |
10916 KB |
Output is correct |
47 |
Correct |
1864 ms |
10936 KB |
Output is correct |
48 |
Correct |
1958 ms |
10912 KB |
Output is correct |
49 |
Correct |
1908 ms |
10912 KB |
Output is correct |
50 |
Correct |
5 ms |
9804 KB |
Output is correct |
51 |
Correct |
5 ms |
9804 KB |
Output is correct |
52 |
Correct |
5 ms |
9804 KB |
Output is correct |
53 |
Correct |
5 ms |
9812 KB |
Output is correct |
54 |
Correct |
6 ms |
9808 KB |
Output is correct |
55 |
Correct |
6 ms |
9804 KB |
Output is correct |
56 |
Correct |
5 ms |
9804 KB |
Output is correct |
57 |
Correct |
6 ms |
9804 KB |
Output is correct |
58 |
Correct |
6 ms |
9804 KB |
Output is correct |
59 |
Correct |
6 ms |
9816 KB |
Output is correct |
60 |
Correct |
6 ms |
9812 KB |
Output is correct |
61 |
Correct |
6 ms |
9804 KB |
Output is correct |
62 |
Correct |
5 ms |
9804 KB |
Output is correct |
63 |
Correct |
5 ms |
9804 KB |
Output is correct |
64 |
Correct |
20 ms |
9804 KB |
Output is correct |
65 |
Correct |
21 ms |
9924 KB |
Output is correct |
66 |
Correct |
23 ms |
10028 KB |
Output is correct |
67 |
Correct |
20 ms |
9880 KB |
Output is correct |
68 |
Correct |
20 ms |
9884 KB |
Output is correct |
69 |
Correct |
11 ms |
9804 KB |
Output is correct |
70 |
Correct |
23 ms |
9804 KB |
Output is correct |
71 |
Correct |
22 ms |
9904 KB |
Output is correct |
72 |
Correct |
22 ms |
9916 KB |
Output is correct |
73 |
Correct |
20 ms |
9868 KB |
Output is correct |
74 |
Correct |
19 ms |
9896 KB |
Output is correct |
75 |
Correct |
20 ms |
9884 KB |
Output is correct |
76 |
Correct |
18 ms |
9876 KB |
Output is correct |
77 |
Correct |
18 ms |
9876 KB |
Output is correct |
78 |
Correct |
2127 ms |
11216 KB |
Output is correct |
79 |
Correct |
2133 ms |
11132 KB |
Output is correct |
80 |
Correct |
2029 ms |
10920 KB |
Output is correct |
81 |
Correct |
1922 ms |
10808 KB |
Output is correct |
82 |
Correct |
1895 ms |
10820 KB |
Output is correct |
83 |
Correct |
638 ms |
10720 KB |
Output is correct |
84 |
Correct |
2141 ms |
11084 KB |
Output is correct |
85 |
Correct |
2366 ms |
10940 KB |
Output is correct |
86 |
Correct |
2196 ms |
11084 KB |
Output is correct |
87 |
Correct |
1976 ms |
10812 KB |
Output is correct |
88 |
Correct |
1998 ms |
10908 KB |
Output is correct |
89 |
Correct |
1865 ms |
10820 KB |
Output is correct |
90 |
Correct |
1787 ms |
10708 KB |
Output is correct |
91 |
Correct |
1758 ms |
10700 KB |
Output is correct |
92 |
Execution timed out |
7093 ms |
26376 KB |
Time limit exceeded |
93 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9676 KB |
Output is correct |
2 |
Correct |
5 ms |
9784 KB |
Output is correct |
3 |
Correct |
6 ms |
9676 KB |
Output is correct |
4 |
Correct |
5 ms |
9804 KB |
Output is correct |
5 |
Correct |
5 ms |
9676 KB |
Output is correct |
6 |
Correct |
5 ms |
9676 KB |
Output is correct |
7 |
Correct |
6 ms |
9808 KB |
Output is correct |
8 |
Correct |
5 ms |
9676 KB |
Output is correct |
9 |
Correct |
5 ms |
9676 KB |
Output is correct |
10 |
Correct |
5 ms |
9856 KB |
Output is correct |
11 |
Correct |
6 ms |
9776 KB |
Output is correct |
12 |
Correct |
5 ms |
9676 KB |
Output is correct |
13 |
Correct |
6 ms |
9676 KB |
Output is correct |
14 |
Correct |
5 ms |
9676 KB |
Output is correct |
15 |
Correct |
5 ms |
9796 KB |
Output is correct |
16 |
Correct |
5 ms |
9676 KB |
Output is correct |
17 |
Correct |
6 ms |
9676 KB |
Output is correct |
18 |
Correct |
5 ms |
9676 KB |
Output is correct |
19 |
Correct |
5 ms |
9676 KB |
Output is correct |
20 |
Correct |
7 ms |
9676 KB |
Output is correct |
21 |
Correct |
5 ms |
9676 KB |
Output is correct |
22 |
Correct |
5 ms |
9676 KB |
Output is correct |
23 |
Correct |
5 ms |
9768 KB |
Output is correct |
24 |
Correct |
5 ms |
9676 KB |
Output is correct |
25 |
Correct |
5 ms |
9676 KB |
Output is correct |
26 |
Correct |
5 ms |
9676 KB |
Output is correct |
27 |
Correct |
5 ms |
9676 KB |
Output is correct |
28 |
Correct |
5 ms |
9784 KB |
Output is correct |
29 |
Correct |
5 ms |
9676 KB |
Output is correct |
30 |
Correct |
5 ms |
9796 KB |
Output is correct |
31 |
Correct |
5 ms |
9676 KB |
Output is correct |
32 |
Correct |
5 ms |
9676 KB |
Output is correct |
33 |
Correct |
5 ms |
9804 KB |
Output is correct |
34 |
Correct |
5 ms |
9676 KB |
Output is correct |
35 |
Correct |
5 ms |
9800 KB |
Output is correct |
36 |
Correct |
2114 ms |
11140 KB |
Output is correct |
37 |
Correct |
2229 ms |
11128 KB |
Output is correct |
38 |
Correct |
2057 ms |
10912 KB |
Output is correct |
39 |
Correct |
1938 ms |
10812 KB |
Output is correct |
40 |
Correct |
1882 ms |
10752 KB |
Output is correct |
41 |
Correct |
616 ms |
10572 KB |
Output is correct |
42 |
Correct |
2133 ms |
11212 KB |
Output is correct |
43 |
Correct |
2439 ms |
10936 KB |
Output is correct |
44 |
Correct |
2236 ms |
11084 KB |
Output is correct |
45 |
Correct |
1931 ms |
10808 KB |
Output is correct |
46 |
Correct |
1944 ms |
10916 KB |
Output is correct |
47 |
Correct |
1864 ms |
10936 KB |
Output is correct |
48 |
Correct |
1958 ms |
10912 KB |
Output is correct |
49 |
Correct |
1908 ms |
10912 KB |
Output is correct |
50 |
Correct |
5 ms |
9804 KB |
Output is correct |
51 |
Correct |
5 ms |
9804 KB |
Output is correct |
52 |
Correct |
5 ms |
9804 KB |
Output is correct |
53 |
Correct |
5 ms |
9812 KB |
Output is correct |
54 |
Correct |
6 ms |
9808 KB |
Output is correct |
55 |
Correct |
6 ms |
9804 KB |
Output is correct |
56 |
Correct |
5 ms |
9804 KB |
Output is correct |
57 |
Correct |
6 ms |
9804 KB |
Output is correct |
58 |
Correct |
6 ms |
9804 KB |
Output is correct |
59 |
Correct |
6 ms |
9816 KB |
Output is correct |
60 |
Correct |
6 ms |
9812 KB |
Output is correct |
61 |
Correct |
6 ms |
9804 KB |
Output is correct |
62 |
Correct |
5 ms |
9804 KB |
Output is correct |
63 |
Correct |
5 ms |
9804 KB |
Output is correct |
64 |
Correct |
20 ms |
9804 KB |
Output is correct |
65 |
Correct |
21 ms |
9924 KB |
Output is correct |
66 |
Correct |
23 ms |
10028 KB |
Output is correct |
67 |
Correct |
20 ms |
9880 KB |
Output is correct |
68 |
Correct |
20 ms |
9884 KB |
Output is correct |
69 |
Correct |
11 ms |
9804 KB |
Output is correct |
70 |
Correct |
23 ms |
9804 KB |
Output is correct |
71 |
Correct |
22 ms |
9904 KB |
Output is correct |
72 |
Correct |
22 ms |
9916 KB |
Output is correct |
73 |
Correct |
20 ms |
9868 KB |
Output is correct |
74 |
Correct |
19 ms |
9896 KB |
Output is correct |
75 |
Correct |
20 ms |
9884 KB |
Output is correct |
76 |
Correct |
18 ms |
9876 KB |
Output is correct |
77 |
Correct |
18 ms |
9876 KB |
Output is correct |
78 |
Correct |
2127 ms |
11216 KB |
Output is correct |
79 |
Correct |
2133 ms |
11132 KB |
Output is correct |
80 |
Correct |
2029 ms |
10920 KB |
Output is correct |
81 |
Correct |
1922 ms |
10808 KB |
Output is correct |
82 |
Correct |
1895 ms |
10820 KB |
Output is correct |
83 |
Correct |
638 ms |
10720 KB |
Output is correct |
84 |
Correct |
2141 ms |
11084 KB |
Output is correct |
85 |
Correct |
2366 ms |
10940 KB |
Output is correct |
86 |
Correct |
2196 ms |
11084 KB |
Output is correct |
87 |
Correct |
1976 ms |
10812 KB |
Output is correct |
88 |
Correct |
1998 ms |
10908 KB |
Output is correct |
89 |
Correct |
1865 ms |
10820 KB |
Output is correct |
90 |
Correct |
1787 ms |
10708 KB |
Output is correct |
91 |
Correct |
1758 ms |
10700 KB |
Output is correct |
92 |
Execution timed out |
7093 ms |
26376 KB |
Time limit exceeded |
93 |
Halted |
0 ms |
0 KB |
- |