#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 500000
#define M 2000000
#define INF 0x3f3f3f3f
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int *ej[N], eo[N], n;
int ii[M], jj[M], ww[M], m;
void append(int i, int j) {
int o = eo[i]++;
if (o >= 2 && (o & o - 1) == 0)
ej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]);
ej[i][o] = j;
}
int d_, i_;
void dfs1(int p, int i, int d) {
int o;
if (d_ < d)
d_ = d, i_ = i;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p)
dfs1(i, j, d + 1);
}
}
int u, v;
int dfs2(int p, int i) {
int o, s;
s = 1;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p)
s += dfs2(i, j);
}
if (s * 3 <= n)
return s;
if (u == -1)
u = i;
else
v = i;
return 0;
}
int rr[N], dd[N], dp1[N], dp2[N], jj1[N][4], jj2[N][4], dq1[N], dq2[N];
void dfs3(int p, int i, int r, int d) {
int o, g, g_;
rr[i] = r, dd[i] = d;
memset(jj1[i], -1, sizeof jj1[i]), memset(jj2[i], -1, sizeof jj2[i]);
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p) {
dfs3(i, j, r == -1 ? j : r, d + 1);
for (g = 0; g < 4; g++)
if (jj1[i][g] == -1 || dp1[jj1[i][g]] < dp1[j]) {
for (g_ = 3; g_ > g; g_--)
jj1[i][g_] = jj1[i][g_ - 1];
jj1[i][g] = j;
break;
}
for (g = 0; g < 4; g++)
if (jj2[i][g] == -1 || dp2[jj2[i][g]] < dp2[j]) {
for (g_ = 3; g_ > g; g_--)
jj2[i][g_] = jj2[i][g_ - 1];
jj2[i][g] = j;
break;
}
}
}
dp1[i] = dp2[i] = 0;
dp1[i] = max(dp1[i], (jj1[i][0] == -1 ? 0 : dp1[jj1[i][0]] + 1));
dp2[i] = max(dp2[i], jj2[i][0] == -1 ? 0 : dp2[jj2[i][0]]);
dp2[i] = max(dp2[i], (jj1[i][0] == -1 ? 0 : dp1[jj1[i][0]] + 1) + (jj1[i][1] == -1 ? 0 : dp1[jj1[i][1]] + 1));
}
void dfs4(int p, int i, int w, int x, int y, int z) {
int o;
if (p == -1)
dq1[i] = dq2[i] = -INF;
else
dq1[i] = max(w, dp1[i] - dd[i]), dq2[i] = max(max(x + dp1[i], y) + 2, max(dp2[i], z));
for (o = eo[i]; o--; ) {
int j = ej[i][o], j_, j1, j2;
if (j != p) {
int w_, x_, y_, z_;
w_ = w, x_ = x, y_ = y, z_ = z;
if (p != -1) {
j_ = j == jj1[i][0] ? jj1[i][1] : jj1[i][0];
w_ = max(w_, (j_ == -1 ? 0 : dp1[j_] + 1) - dd[i]);
x_ = max(x_, j_ == -1 ? 0 : dp1[j_] + 1);
y_ = max(y_, x + (j_ == -1 ? 0 : dp1[j_] + 1));
j_ = j == jj2[i][0] ? jj2[i][1] : jj2[i][0];
z_ = max(z_, j_ == -1 ? 0 : dp2[j_]);
if (j == jj1[i][0])
j1 = jj1[i][1], j2 = jj1[i][2];
else if (j == jj1[i][1])
j1 = jj1[i][0], j2 = jj1[i][2];
else
j1 = jj1[i][0], j2 = jj1[i][1];
z_ = max(z_, (j1 == -1 ? 0 : dp1[j1] + 1) + (j2 == -1 ? 0 : dp1[j2] + 1));
}
x_--;
dfs4(i, j, w_, x_, y_, z_);
}
}
}
int ans;
void solve(int s) {
int g, h, i, j, j1, j2, x;
dfs3(-1, s, -1, 0);
dfs4(-1, s, -INF, -INF, -INF, -INF);
for (h = 0; h < m; h++) {
i = ii[h], j = jj[h];
if (ww[h] != 1 && rr[i] != rr[j]) {
x = max(max(dq2[i], dq2[j]), dq1[i] + dq1[j] + 2);
j1 = j2 = -1;
for (g = 0; g < 4; g++)
if (jj1[s][g] != -1 && jj1[s][g] != rr[i] && jj1[s][g] != rr[j]) {
if (j1 == -1)
j1 = jj1[s][g];
else if (j2 == -1)
j2 = jj1[s][g];
}
x = max(x, max(dq1[i], dq1[j]) + (j1 == -1 ? 0 : dp1[j1] + 1) + 2);
x = max(x, (j1 == -1 ? 0 : dp1[j1] + 1) + (j2 == -1 ? 0 : dp1[j2] + 1));
if (jj2[s][0] != rr[i] && jj2[s][0] != rr[j])
j2 = jj2[s][0];
else if (jj2[s][1] != rr[i] && jj2[s][1] != rr[j])
j2 = jj2[s][1];
else
j2 = jj2[s][2];
x = max(x, (j2 == -1 ? 0 : dp2[j2]));
ans = min(ans, (n - 1) * 2 - dd[i] - dd[j] + ww[h] - x);
}
}
}
int main() {
int h, i, j;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++)
ej[i] = (int *) malloc(2 * sizeof *ej[i]);
for (h = 0; h < m; h++) {
scanf("%d%d%d", &i, &j, &ww[h]), ii[h] = i, jj[h] = j;
if (ww[h] == 1)
append(i, j), append(j, i);
}
d_ = -1, dfs1(-1, 0, 0);
d_ = -1, dfs1(-1, i_, 0);
ans = (n - 1) * 2 - d_;
u = -1, v = -1, dfs2(-1, 0);
if (u != -1)
solve(u);
if (v != -1)
solve(v);
printf("%d\n", ans);
return 0;
}
Compilation message
Main.c: In function 'append':
Main.c:18:23: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
18 | if (o >= 2 && (o & o - 1) == 0)
| ~~^~~
Main.c: In function 'main':
Main.c:164:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
164 | scanf("%d%d", &n, &m);
| ^~~~~~~~~~~~~~~~~~~~~
Main.c:168:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
168 | scanf("%d%d%d", &i, &j, &ww[h]), ii[h] = i, jj[h] = j;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1384 KB |
Output is correct |
2 |
Correct |
6 ms |
1364 KB |
Output is correct |
3 |
Correct |
5 ms |
1236 KB |
Output is correct |
4 |
Correct |
4 ms |
1108 KB |
Output is correct |
5 |
Correct |
4 ms |
1108 KB |
Output is correct |
6 |
Correct |
3 ms |
980 KB |
Output is correct |
7 |
Correct |
5 ms |
1292 KB |
Output is correct |
8 |
Correct |
5 ms |
1240 KB |
Output is correct |
9 |
Correct |
4 ms |
1236 KB |
Output is correct |
10 |
Correct |
5 ms |
1108 KB |
Output is correct |
11 |
Correct |
5 ms |
1236 KB |
Output is correct |
12 |
Correct |
4 ms |
1108 KB |
Output is correct |
13 |
Correct |
5 ms |
1236 KB |
Output is correct |
14 |
Correct |
6 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
0 ms |
340 KB |
Output is correct |
38 |
Correct |
0 ms |
340 KB |
Output is correct |
39 |
Correct |
0 ms |
340 KB |
Output is correct |
40 |
Correct |
1 ms |
340 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
0 ms |
340 KB |
Output is correct |
45 |
Correct |
0 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
1 ms |
340 KB |
Output is correct |
48 |
Correct |
1 ms |
340 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
0 ms |
340 KB |
Output is correct |
38 |
Correct |
0 ms |
340 KB |
Output is correct |
39 |
Correct |
0 ms |
340 KB |
Output is correct |
40 |
Correct |
1 ms |
340 KB |
Output is correct |
41 |
Correct |
0 ms |
340 KB |
Output is correct |
42 |
Correct |
0 ms |
340 KB |
Output is correct |
43 |
Correct |
0 ms |
340 KB |
Output is correct |
44 |
Correct |
0 ms |
340 KB |
Output is correct |
45 |
Correct |
0 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
1 ms |
340 KB |
Output is correct |
48 |
Correct |
1 ms |
340 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
50 |
Correct |
1 ms |
468 KB |
Output is correct |
51 |
Correct |
1 ms |
468 KB |
Output is correct |
52 |
Correct |
1 ms |
340 KB |
Output is correct |
53 |
Correct |
1 ms |
340 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
1 ms |
340 KB |
Output is correct |
56 |
Correct |
1 ms |
468 KB |
Output is correct |
57 |
Correct |
1 ms |
468 KB |
Output is correct |
58 |
Correct |
1 ms |
468 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
1 ms |
468 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
6 ms |
1384 KB |
Output is correct |
37 |
Correct |
6 ms |
1364 KB |
Output is correct |
38 |
Correct |
5 ms |
1236 KB |
Output is correct |
39 |
Correct |
4 ms |
1108 KB |
Output is correct |
40 |
Correct |
4 ms |
1108 KB |
Output is correct |
41 |
Correct |
3 ms |
980 KB |
Output is correct |
42 |
Correct |
5 ms |
1292 KB |
Output is correct |
43 |
Correct |
5 ms |
1240 KB |
Output is correct |
44 |
Correct |
4 ms |
1236 KB |
Output is correct |
45 |
Correct |
5 ms |
1108 KB |
Output is correct |
46 |
Correct |
5 ms |
1236 KB |
Output is correct |
47 |
Correct |
4 ms |
1108 KB |
Output is correct |
48 |
Correct |
5 ms |
1236 KB |
Output is correct |
49 |
Correct |
6 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
340 KB |
Output is correct |
51 |
Correct |
0 ms |
340 KB |
Output is correct |
52 |
Correct |
0 ms |
340 KB |
Output is correct |
53 |
Correct |
0 ms |
340 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
0 ms |
340 KB |
Output is correct |
56 |
Correct |
0 ms |
340 KB |
Output is correct |
57 |
Correct |
0 ms |
340 KB |
Output is correct |
58 |
Correct |
0 ms |
340 KB |
Output is correct |
59 |
Correct |
0 ms |
340 KB |
Output is correct |
60 |
Correct |
1 ms |
340 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
468 KB |
Output is correct |
65 |
Correct |
1 ms |
468 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
340 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
1 ms |
468 KB |
Output is correct |
71 |
Correct |
1 ms |
468 KB |
Output is correct |
72 |
Correct |
1 ms |
468 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
1 ms |
468 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
340 KB |
Output is correct |
78 |
Correct |
4 ms |
1364 KB |
Output is correct |
79 |
Correct |
5 ms |
1364 KB |
Output is correct |
80 |
Correct |
5 ms |
1172 KB |
Output is correct |
81 |
Correct |
5 ms |
1108 KB |
Output is correct |
82 |
Correct |
4 ms |
1108 KB |
Output is correct |
83 |
Correct |
3 ms |
936 KB |
Output is correct |
84 |
Correct |
5 ms |
1320 KB |
Output is correct |
85 |
Correct |
5 ms |
1236 KB |
Output is correct |
86 |
Correct |
4 ms |
1296 KB |
Output is correct |
87 |
Correct |
5 ms |
1108 KB |
Output is correct |
88 |
Correct |
5 ms |
1236 KB |
Output is correct |
89 |
Correct |
4 ms |
1204 KB |
Output is correct |
90 |
Correct |
3 ms |
1108 KB |
Output is correct |
91 |
Correct |
3 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
6 ms |
1384 KB |
Output is correct |
37 |
Correct |
6 ms |
1364 KB |
Output is correct |
38 |
Correct |
5 ms |
1236 KB |
Output is correct |
39 |
Correct |
4 ms |
1108 KB |
Output is correct |
40 |
Correct |
4 ms |
1108 KB |
Output is correct |
41 |
Correct |
3 ms |
980 KB |
Output is correct |
42 |
Correct |
5 ms |
1292 KB |
Output is correct |
43 |
Correct |
5 ms |
1240 KB |
Output is correct |
44 |
Correct |
4 ms |
1236 KB |
Output is correct |
45 |
Correct |
5 ms |
1108 KB |
Output is correct |
46 |
Correct |
5 ms |
1236 KB |
Output is correct |
47 |
Correct |
4 ms |
1108 KB |
Output is correct |
48 |
Correct |
5 ms |
1236 KB |
Output is correct |
49 |
Correct |
6 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
340 KB |
Output is correct |
51 |
Correct |
0 ms |
340 KB |
Output is correct |
52 |
Correct |
0 ms |
340 KB |
Output is correct |
53 |
Correct |
0 ms |
340 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
0 ms |
340 KB |
Output is correct |
56 |
Correct |
0 ms |
340 KB |
Output is correct |
57 |
Correct |
0 ms |
340 KB |
Output is correct |
58 |
Correct |
0 ms |
340 KB |
Output is correct |
59 |
Correct |
0 ms |
340 KB |
Output is correct |
60 |
Correct |
1 ms |
340 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
468 KB |
Output is correct |
65 |
Correct |
1 ms |
468 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
340 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
1 ms |
468 KB |
Output is correct |
71 |
Correct |
1 ms |
468 KB |
Output is correct |
72 |
Correct |
1 ms |
468 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
1 ms |
468 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
340 KB |
Output is correct |
78 |
Correct |
4 ms |
1364 KB |
Output is correct |
79 |
Correct |
5 ms |
1364 KB |
Output is correct |
80 |
Correct |
5 ms |
1172 KB |
Output is correct |
81 |
Correct |
5 ms |
1108 KB |
Output is correct |
82 |
Correct |
4 ms |
1108 KB |
Output is correct |
83 |
Correct |
3 ms |
936 KB |
Output is correct |
84 |
Correct |
5 ms |
1320 KB |
Output is correct |
85 |
Correct |
5 ms |
1236 KB |
Output is correct |
86 |
Correct |
4 ms |
1296 KB |
Output is correct |
87 |
Correct |
5 ms |
1108 KB |
Output is correct |
88 |
Correct |
5 ms |
1236 KB |
Output is correct |
89 |
Correct |
4 ms |
1204 KB |
Output is correct |
90 |
Correct |
3 ms |
1108 KB |
Output is correct |
91 |
Correct |
3 ms |
1108 KB |
Output is correct |
92 |
Correct |
136 ms |
15624 KB |
Output is correct |
93 |
Correct |
122 ms |
16700 KB |
Output is correct |
94 |
Correct |
92 ms |
15656 KB |
Output is correct |
95 |
Correct |
95 ms |
13828 KB |
Output is correct |
96 |
Correct |
104 ms |
13684 KB |
Output is correct |
97 |
Correct |
157 ms |
18764 KB |
Output is correct |
98 |
Correct |
138 ms |
18788 KB |
Output is correct |
99 |
Correct |
89 ms |
16696 KB |
Output is correct |
100 |
Correct |
101 ms |
15612 KB |
Output is correct |
101 |
Correct |
89 ms |
14980 KB |
Output is correct |
102 |
Correct |
61 ms |
12876 KB |
Output is correct |
103 |
Correct |
135 ms |
18704 KB |
Output is correct |
104 |
Correct |
128 ms |
16460 KB |
Output is correct |
105 |
Correct |
118 ms |
18124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
0 ms |
340 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
0 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
340 KB |
Output is correct |
22 |
Correct |
0 ms |
340 KB |
Output is correct |
23 |
Correct |
0 ms |
340 KB |
Output is correct |
24 |
Correct |
0 ms |
340 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
0 ms |
340 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
6 ms |
1384 KB |
Output is correct |
37 |
Correct |
6 ms |
1364 KB |
Output is correct |
38 |
Correct |
5 ms |
1236 KB |
Output is correct |
39 |
Correct |
4 ms |
1108 KB |
Output is correct |
40 |
Correct |
4 ms |
1108 KB |
Output is correct |
41 |
Correct |
3 ms |
980 KB |
Output is correct |
42 |
Correct |
5 ms |
1292 KB |
Output is correct |
43 |
Correct |
5 ms |
1240 KB |
Output is correct |
44 |
Correct |
4 ms |
1236 KB |
Output is correct |
45 |
Correct |
5 ms |
1108 KB |
Output is correct |
46 |
Correct |
5 ms |
1236 KB |
Output is correct |
47 |
Correct |
4 ms |
1108 KB |
Output is correct |
48 |
Correct |
5 ms |
1236 KB |
Output is correct |
49 |
Correct |
6 ms |
1236 KB |
Output is correct |
50 |
Correct |
1 ms |
340 KB |
Output is correct |
51 |
Correct |
0 ms |
340 KB |
Output is correct |
52 |
Correct |
0 ms |
340 KB |
Output is correct |
53 |
Correct |
0 ms |
340 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
0 ms |
340 KB |
Output is correct |
56 |
Correct |
0 ms |
340 KB |
Output is correct |
57 |
Correct |
0 ms |
340 KB |
Output is correct |
58 |
Correct |
0 ms |
340 KB |
Output is correct |
59 |
Correct |
0 ms |
340 KB |
Output is correct |
60 |
Correct |
1 ms |
340 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
468 KB |
Output is correct |
65 |
Correct |
1 ms |
468 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
340 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
1 ms |
468 KB |
Output is correct |
71 |
Correct |
1 ms |
468 KB |
Output is correct |
72 |
Correct |
1 ms |
468 KB |
Output is correct |
73 |
Correct |
1 ms |
340 KB |
Output is correct |
74 |
Correct |
1 ms |
468 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
340 KB |
Output is correct |
78 |
Correct |
4 ms |
1364 KB |
Output is correct |
79 |
Correct |
5 ms |
1364 KB |
Output is correct |
80 |
Correct |
5 ms |
1172 KB |
Output is correct |
81 |
Correct |
5 ms |
1108 KB |
Output is correct |
82 |
Correct |
4 ms |
1108 KB |
Output is correct |
83 |
Correct |
3 ms |
936 KB |
Output is correct |
84 |
Correct |
5 ms |
1320 KB |
Output is correct |
85 |
Correct |
5 ms |
1236 KB |
Output is correct |
86 |
Correct |
4 ms |
1296 KB |
Output is correct |
87 |
Correct |
5 ms |
1108 KB |
Output is correct |
88 |
Correct |
5 ms |
1236 KB |
Output is correct |
89 |
Correct |
4 ms |
1204 KB |
Output is correct |
90 |
Correct |
3 ms |
1108 KB |
Output is correct |
91 |
Correct |
3 ms |
1108 KB |
Output is correct |
92 |
Correct |
136 ms |
15624 KB |
Output is correct |
93 |
Correct |
122 ms |
16700 KB |
Output is correct |
94 |
Correct |
92 ms |
15656 KB |
Output is correct |
95 |
Correct |
95 ms |
13828 KB |
Output is correct |
96 |
Correct |
104 ms |
13684 KB |
Output is correct |
97 |
Correct |
157 ms |
18764 KB |
Output is correct |
98 |
Correct |
138 ms |
18788 KB |
Output is correct |
99 |
Correct |
89 ms |
16696 KB |
Output is correct |
100 |
Correct |
101 ms |
15612 KB |
Output is correct |
101 |
Correct |
89 ms |
14980 KB |
Output is correct |
102 |
Correct |
61 ms |
12876 KB |
Output is correct |
103 |
Correct |
135 ms |
18704 KB |
Output is correct |
104 |
Correct |
128 ms |
16460 KB |
Output is correct |
105 |
Correct |
118 ms |
18124 KB |
Output is correct |
106 |
Correct |
1853 ms |
149672 KB |
Output is correct |
107 |
Correct |
2004 ms |
149632 KB |
Output is correct |
108 |
Correct |
1464 ms |
136548 KB |
Output is correct |
109 |
Correct |
1487 ms |
130036 KB |
Output is correct |
110 |
Correct |
1604 ms |
126064 KB |
Output is correct |
111 |
Correct |
974 ms |
112596 KB |
Output is correct |
112 |
Correct |
1891 ms |
149596 KB |
Output is correct |
113 |
Correct |
1828 ms |
135540 KB |
Output is correct |
114 |
Correct |
1854 ms |
145244 KB |
Output is correct |
115 |
Correct |
1843 ms |
130028 KB |
Output is correct |
116 |
Correct |
1783 ms |
136716 KB |
Output is correct |
117 |
Correct |
1440 ms |
130068 KB |
Output is correct |
118 |
Correct |
1306 ms |
84924 KB |
Output is correct |
119 |
Correct |
1224 ms |
84848 KB |
Output is correct |