# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
504030 |
2022-01-09T14:31:03 Z |
rainboy |
Wells (CEOI21_wells) |
C |
|
726 ms |
65440 KB |
/* https://hsin.hr/ceoi/competition/ceoi2021_day2_editorial.pdf */
#include <stdio.h>
#include <stdlib.h>
#define N 500000
#define SMALL 10000
#define MD 1000000007
#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 pp2[N + 1];
void init() {
int i;
pp2[0] = 1;
for (i = 1; i <= N; i++)
pp2[i] = pp2[i - 1] * 2 % MD;
}
int mem[(N - 1) * 2], *ptr = mem;
int *ej[N], eo[N], pp[N], n, k; char type[N];
int i_, l;
int ii[N]; char path[N];
void dfs1(int p, int i, int d) {
int o;
pp[i] = p;
d++;
if (l < d)
l = d, i_ = i;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p)
dfs1(i, j, d);
}
}
int gg[N], dd[N], hh[N];
void dfs2(int p, int i, int g, int d) {
int o;
gg[i] = g, dd[i] = d, hh[i] = 0;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p && !path[j]) {
dfs2(i, j, g, d + 1);
hh[i] = max(hh[i], hh[j] + 1);
}
}
}
int dfs3(int p, int i, int d) {
int o, x;
if (d == 0 || type[i] == -1)
return 1;
x = 1;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p)
x = (long long) x * dfs3(i, j, d - 1) % MD;
}
return (x + 1) % MD;
}
int cc[N], dp[N], dq[N], dr[N];
int dfs4(int p, int i) {
int o, p1, p2;
dp[i] = -INF, dq[i] = 0, dr[i] = -1, p1 = p2 = -INF;
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != p && !path[j] && type[j] == 1) {
if (!dfs4(i, j))
return 0;
dp[i] = max(dp[i], dp[j]);
if (p1 < dp[j])
p2 = p1, p1 = dp[j];
else if (p2 < dp[j])
p2 = dp[j];
if (cc[i] == 0 && dq[i] + dq[j] + 1 >= k - 1)
return 0;
dq[i] = max(dq[i], dq[j] + 1);
if (dr[j] != -1)
dr[i] = dr[j] + 1;
}
}
if (cc[i] == 1)
dp[i] = hh[i], dq[i] = -1, dr[i] = 0;
else if (p2 != -INF && dr[i] * 2 <= k - 1 && dr[i] * 2 + p1 + p2 >= k - 1)
return 0;
return 1;
}
char bad[N];
void mark_bad() {
static int aa[N + 1];
int g, r, i, d;
for (g = 0; g < l; g++)
if (type[ii[g]] == 1) {
int lower, upper;
lower = g + 1, upper = min(g * 2, k - 1);
if (lower <= upper)
aa[lower]++, aa[upper + 1]--;
lower = max(g * 2 - l + 1, l - k), upper = g - 1;
if (lower <= upper) {
lower %= k, upper %= k;
aa[lower]++, aa[upper + 1]--;
if (lower > upper)
aa[0]++;
}
}
for (r = 1; r < k; r++)
aa[r] += aa[r - 1];
for (r = 0; r < k; r++)
if (aa[r])
bad[r] = 1;
for (i = 0; i < n; i++)
if (!path[i] && type[i] == 1) {
int r1, r2;
g = gg[i], d = dd[i];
r1 = (g + d) % k, r2 = (g - d % k + k) % k;
if (r1 != r2) {
if (g >= r1 && g <= (l - 1 - r1) / k * k + r1)
bad[r1] = 1;
if (g >= r2 && g <= (l - 1 - r2) / k * k + r2)
bad[r2] = 1;
}
}
}
int yes, ans;
void try(int r) {
int g, gl, gr, i, d, x;
if (bad[r])
return;
gl = r, gr = (l - 1 - r) / k * k + r;
for (i = 0; i < n; i++) {
g = gg[i], d = dd[i];
if (path[i])
cc[i] = g % k == r ? 1 : 0;
else if (type[i] == 1)
cc[i] = g >= gl ? ((g + d) % k == r ? 1 : 0) : ((g - d % k + k) % k == r ? 1 : 0);
}
x = 1;
for (i = 0; i < n; i++)
if (!path[i] && type[i] == 0 && (path[pp[i]] || type[pp[i]] == 1)) {
g = gg[i], d = dd[i];
if (g + dd[i] + hh[i] >= k - 1) {
if (g < gl)
x = (long long) x * dfs3(pp[i], i, k - 1 - (g + dd[i])) % MD;
} else {
if (g > gr)
x = (long long) x * dfs3(pp[i], i, k - 1 - (l - 1 - g + dd[i])) % MD;
}
}
for (g = 0; g < l; g++)
if (type[ii[g]] == 1 && !dfs4(-1, ii[g]))
return;
yes = 1, ans = (ans + x) % MD;
}
int main() {
static int uu[N - 1], vv[N - 1];
int g, h, i, j, u, v, d, r, deep;
init();
scanf("%d%d", &n, &k);
if (k == 2) {
printf("YES\n");
printf("2\n");
return 0;
}
for (h = 0; h < n - 1; h++) {
scanf("%d%d", &i, &j), i--, j--;
uu[h] = i, vv[h] = j;
eo[i]++, eo[j]++;
}
for (i = 0; i < n; i++) {
ej[i] = ptr, ptr += eo[i];
eo[i] = 0;
}
for (h = 0; h < n - 1; h++) {
i = uu[h], j = vv[h];
ej[i][eo[i]++] = j, ej[j][eo[j]++] = i;
}
i_ = -1, l = -1, dfs1(-1, 0, 0), u = i_;
i_ = -1, l = -1, dfs1(-1, u, 0), v = i_;
if (l < k) {
printf("YES\n");
printf("%d\n", pp2[n]);
return 0;
}
for (i = v, d = l - 1; i != u; i = pp[i], d--)
path[ii[d] = i] = 1;
path[ii[0] = u] = 1;
for (g = 0; g < l; g++)
dfs2(-1, ii[g], g, 0);
for (i = 0; i < n; i++) {
g = gg[i];
if (max(g, l - 1 - g) + dd[i] + hh[i] < k - 1)
type[i] = -1;
else if (min(g, l - 1 - g) + dd[i] + hh[i] >= k - 1)
type[i] = 1;
else
type[i] = 0;
}
mark_bad();
yes = 0, ans = 0;
deep = 0;
for (i = 0; i < n; i++)
if (dd[i] * 2 >= k - 1) {
deep = 1;
break;
}
if (deep || n <= SMALL)
for (r = 0; r < k; r++)
try(r);
else {
for (r = 0; r < k; r++)
if (!bad[r]) {
printf("YES\n");
printf("0\n");
return 0;
}
printf("NO\n");
printf("0\n");
return 0;
}
if (yes) {
printf("YES\n");
for (i = 0; i < n; i++)
if (!path[i] && type[i] == -1)
ans = ans * 2 % MD;
printf("%d\n", ans);
} else {
printf("NO\n");
printf("0\n");
}
return 0;
}
Compilation message
wells.c: In function 'main':
wells.c:185:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
185 | scanf("%d%d", &n, &k);
| ^~~~~~~~~~~~~~~~~~~~~
wells.c:192:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
192 | scanf("%d%d", &i, &j), i--, j--;
| ^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2380 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2380 KB |
Output is correct |
5 |
Correct |
3 ms |
2380 KB |
Output is correct |
6 |
Correct |
3 ms |
2380 KB |
Output is correct |
7 |
Correct |
3 ms |
2380 KB |
Output is correct |
8 |
Correct |
3 ms |
2380 KB |
Output is correct |
9 |
Correct |
3 ms |
2380 KB |
Output is correct |
10 |
Correct |
3 ms |
2252 KB |
Output is correct |
11 |
Correct |
3 ms |
2316 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2380 KB |
Output is correct |
14 |
Correct |
3 ms |
2380 KB |
Output is correct |
15 |
Correct |
4 ms |
2304 KB |
Output is correct |
16 |
Correct |
4 ms |
2252 KB |
Output is correct |
17 |
Correct |
4 ms |
2252 KB |
Output is correct |
18 |
Correct |
3 ms |
2252 KB |
Output is correct |
19 |
Correct |
3 ms |
2252 KB |
Output is correct |
20 |
Correct |
3 ms |
2252 KB |
Output is correct |
21 |
Correct |
4 ms |
2380 KB |
Output is correct |
22 |
Correct |
4 ms |
2252 KB |
Output is correct |
23 |
Correct |
3 ms |
2252 KB |
Output is correct |
24 |
Correct |
3 ms |
2252 KB |
Output is correct |
25 |
Correct |
3 ms |
2380 KB |
Output is correct |
26 |
Correct |
3 ms |
2336 KB |
Output is correct |
27 |
Correct |
3 ms |
2380 KB |
Output is correct |
28 |
Correct |
3 ms |
2252 KB |
Output is correct |
29 |
Correct |
3 ms |
2380 KB |
Output is correct |
30 |
Correct |
3 ms |
2380 KB |
Output is correct |
31 |
Correct |
3 ms |
2380 KB |
Output is correct |
32 |
Correct |
3 ms |
2252 KB |
Output is correct |
33 |
Correct |
4 ms |
2380 KB |
Output is correct |
34 |
Correct |
3 ms |
2380 KB |
Output is correct |
35 |
Correct |
3 ms |
2252 KB |
Output is correct |
36 |
Correct |
3 ms |
2380 KB |
Output is correct |
37 |
Correct |
3 ms |
2380 KB |
Output is correct |
38 |
Correct |
4 ms |
2380 KB |
Output is correct |
39 |
Correct |
4 ms |
2332 KB |
Output is correct |
40 |
Correct |
4 ms |
2380 KB |
Output is correct |
41 |
Correct |
3 ms |
2380 KB |
Output is correct |
42 |
Correct |
3 ms |
2252 KB |
Output is correct |
43 |
Correct |
3 ms |
2252 KB |
Output is correct |
44 |
Correct |
3 ms |
2252 KB |
Output is correct |
45 |
Correct |
3 ms |
2380 KB |
Output is correct |
46 |
Correct |
3 ms |
2380 KB |
Output is correct |
47 |
Correct |
3 ms |
2252 KB |
Output is correct |
48 |
Correct |
4 ms |
2380 KB |
Output is correct |
49 |
Correct |
3 ms |
2380 KB |
Output is correct |
50 |
Correct |
3 ms |
2380 KB |
Output is correct |
51 |
Correct |
3 ms |
2340 KB |
Output is correct |
52 |
Correct |
3 ms |
2380 KB |
Output is correct |
53 |
Correct |
4 ms |
2252 KB |
Output is correct |
54 |
Correct |
3 ms |
2316 KB |
Output is correct |
55 |
Correct |
3 ms |
2380 KB |
Output is correct |
56 |
Correct |
3 ms |
2252 KB |
Output is correct |
57 |
Correct |
3 ms |
2380 KB |
Output is correct |
58 |
Correct |
3 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2380 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2380 KB |
Output is correct |
5 |
Correct |
3 ms |
2380 KB |
Output is correct |
6 |
Correct |
3 ms |
2380 KB |
Output is correct |
7 |
Correct |
3 ms |
2380 KB |
Output is correct |
8 |
Correct |
3 ms |
2380 KB |
Output is correct |
9 |
Correct |
3 ms |
2380 KB |
Output is correct |
10 |
Correct |
3 ms |
2252 KB |
Output is correct |
11 |
Correct |
3 ms |
2316 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2380 KB |
Output is correct |
14 |
Correct |
3 ms |
2380 KB |
Output is correct |
15 |
Correct |
4 ms |
2304 KB |
Output is correct |
16 |
Correct |
4 ms |
2252 KB |
Output is correct |
17 |
Correct |
4 ms |
2252 KB |
Output is correct |
18 |
Correct |
3 ms |
2252 KB |
Output is correct |
19 |
Correct |
3 ms |
2252 KB |
Output is correct |
20 |
Correct |
3 ms |
2252 KB |
Output is correct |
21 |
Correct |
4 ms |
2380 KB |
Output is correct |
22 |
Correct |
4 ms |
2252 KB |
Output is correct |
23 |
Correct |
3 ms |
2252 KB |
Output is correct |
24 |
Correct |
3 ms |
2252 KB |
Output is correct |
25 |
Correct |
3 ms |
2380 KB |
Output is correct |
26 |
Correct |
3 ms |
2336 KB |
Output is correct |
27 |
Correct |
3 ms |
2380 KB |
Output is correct |
28 |
Correct |
3 ms |
2252 KB |
Output is correct |
29 |
Correct |
3 ms |
2380 KB |
Output is correct |
30 |
Correct |
3 ms |
2380 KB |
Output is correct |
31 |
Correct |
3 ms |
2380 KB |
Output is correct |
32 |
Correct |
3 ms |
2252 KB |
Output is correct |
33 |
Correct |
4 ms |
2380 KB |
Output is correct |
34 |
Correct |
3 ms |
2380 KB |
Output is correct |
35 |
Correct |
3 ms |
2252 KB |
Output is correct |
36 |
Correct |
3 ms |
2380 KB |
Output is correct |
37 |
Correct |
3 ms |
2380 KB |
Output is correct |
38 |
Correct |
4 ms |
2380 KB |
Output is correct |
39 |
Correct |
4 ms |
2332 KB |
Output is correct |
40 |
Correct |
4 ms |
2380 KB |
Output is correct |
41 |
Correct |
3 ms |
2380 KB |
Output is correct |
42 |
Correct |
3 ms |
2252 KB |
Output is correct |
43 |
Correct |
3 ms |
2252 KB |
Output is correct |
44 |
Correct |
3 ms |
2252 KB |
Output is correct |
45 |
Correct |
3 ms |
2380 KB |
Output is correct |
46 |
Correct |
3 ms |
2380 KB |
Output is correct |
47 |
Correct |
3 ms |
2252 KB |
Output is correct |
48 |
Correct |
4 ms |
2380 KB |
Output is correct |
49 |
Correct |
3 ms |
2380 KB |
Output is correct |
50 |
Correct |
3 ms |
2380 KB |
Output is correct |
51 |
Correct |
3 ms |
2340 KB |
Output is correct |
52 |
Correct |
3 ms |
2380 KB |
Output is correct |
53 |
Correct |
4 ms |
2252 KB |
Output is correct |
54 |
Correct |
3 ms |
2316 KB |
Output is correct |
55 |
Correct |
3 ms |
2380 KB |
Output is correct |
56 |
Correct |
3 ms |
2252 KB |
Output is correct |
57 |
Correct |
3 ms |
2380 KB |
Output is correct |
58 |
Correct |
3 ms |
2252 KB |
Output is correct |
59 |
Correct |
4 ms |
2252 KB |
Output is correct |
60 |
Correct |
6 ms |
2704 KB |
Output is correct |
61 |
Correct |
7 ms |
2508 KB |
Output is correct |
62 |
Correct |
4 ms |
2636 KB |
Output is correct |
63 |
Correct |
7 ms |
3064 KB |
Output is correct |
64 |
Correct |
6 ms |
3532 KB |
Output is correct |
65 |
Correct |
6 ms |
2892 KB |
Output is correct |
66 |
Correct |
6 ms |
2892 KB |
Output is correct |
67 |
Correct |
44 ms |
3472 KB |
Output is correct |
68 |
Correct |
5 ms |
2616 KB |
Output is correct |
69 |
Correct |
4 ms |
2508 KB |
Output is correct |
70 |
Correct |
7 ms |
2636 KB |
Output is correct |
71 |
Correct |
5 ms |
2636 KB |
Output is correct |
72 |
Correct |
6 ms |
2636 KB |
Output is correct |
73 |
Correct |
62 ms |
2732 KB |
Output is correct |
74 |
Correct |
260 ms |
3148 KB |
Output is correct |
75 |
Correct |
109 ms |
2892 KB |
Output is correct |
76 |
Correct |
9 ms |
3020 KB |
Output is correct |
77 |
Correct |
6 ms |
2508 KB |
Output is correct |
78 |
Correct |
22 ms |
2600 KB |
Output is correct |
79 |
Correct |
7 ms |
2648 KB |
Output is correct |
80 |
Correct |
180 ms |
2892 KB |
Output is correct |
81 |
Correct |
201 ms |
3000 KB |
Output is correct |
82 |
Correct |
94 ms |
2892 KB |
Output is correct |
83 |
Correct |
99 ms |
3200 KB |
Output is correct |
84 |
Correct |
5 ms |
2764 KB |
Output is correct |
85 |
Correct |
269 ms |
3176 KB |
Output is correct |
86 |
Correct |
8 ms |
3040 KB |
Output is correct |
87 |
Correct |
11 ms |
3148 KB |
Output is correct |
88 |
Correct |
8 ms |
3148 KB |
Output is correct |
89 |
Correct |
6 ms |
3020 KB |
Output is correct |
90 |
Correct |
35 ms |
2636 KB |
Output is correct |
91 |
Correct |
72 ms |
3148 KB |
Output is correct |
92 |
Correct |
212 ms |
3348 KB |
Output is correct |
93 |
Correct |
20 ms |
3148 KB |
Output is correct |
94 |
Correct |
8 ms |
2892 KB |
Output is correct |
95 |
Correct |
20 ms |
2764 KB |
Output is correct |
96 |
Correct |
8 ms |
2620 KB |
Output is correct |
97 |
Correct |
70 ms |
2776 KB |
Output is correct |
98 |
Correct |
79 ms |
2772 KB |
Output is correct |
99 |
Correct |
54 ms |
2764 KB |
Output is correct |
100 |
Correct |
187 ms |
3064 KB |
Output is correct |
101 |
Correct |
33 ms |
3020 KB |
Output is correct |
102 |
Correct |
81 ms |
3148 KB |
Output is correct |
103 |
Correct |
6 ms |
3020 KB |
Output is correct |
104 |
Correct |
8 ms |
3148 KB |
Output is correct |
105 |
Correct |
8 ms |
3224 KB |
Output is correct |
106 |
Correct |
7 ms |
2892 KB |
Output is correct |
107 |
Correct |
7 ms |
3276 KB |
Output is correct |
108 |
Correct |
6 ms |
3020 KB |
Output is correct |
109 |
Correct |
7 ms |
3020 KB |
Output is correct |
110 |
Correct |
12 ms |
3148 KB |
Output is correct |
111 |
Correct |
6 ms |
3020 KB |
Output is correct |
112 |
Correct |
7 ms |
3272 KB |
Output is correct |
113 |
Correct |
7 ms |
3020 KB |
Output is correct |
114 |
Correct |
6 ms |
3148 KB |
Output is correct |
115 |
Correct |
6 ms |
3020 KB |
Output is correct |
116 |
Correct |
7 ms |
3276 KB |
Output is correct |
117 |
Correct |
6 ms |
2972 KB |
Output is correct |
118 |
Correct |
7 ms |
3272 KB |
Output is correct |
119 |
Correct |
6 ms |
3072 KB |
Output is correct |
120 |
Correct |
6 ms |
3276 KB |
Output is correct |
121 |
Correct |
198 ms |
3148 KB |
Output is correct |
122 |
Correct |
200 ms |
3148 KB |
Output is correct |
123 |
Correct |
101 ms |
3132 KB |
Output is correct |
124 |
Correct |
9 ms |
3248 KB |
Output is correct |
125 |
Correct |
6 ms |
2892 KB |
Output is correct |
126 |
Correct |
28 ms |
2764 KB |
Output is correct |
127 |
Correct |
320 ms |
3376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2380 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2380 KB |
Output is correct |
5 |
Correct |
3 ms |
2380 KB |
Output is correct |
6 |
Correct |
3 ms |
2380 KB |
Output is correct |
7 |
Correct |
3 ms |
2380 KB |
Output is correct |
8 |
Correct |
3 ms |
2380 KB |
Output is correct |
9 |
Correct |
3 ms |
2380 KB |
Output is correct |
10 |
Correct |
3 ms |
2252 KB |
Output is correct |
11 |
Correct |
3 ms |
2316 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2380 KB |
Output is correct |
14 |
Correct |
3 ms |
2380 KB |
Output is correct |
15 |
Correct |
4 ms |
2304 KB |
Output is correct |
16 |
Correct |
4 ms |
2252 KB |
Output is correct |
17 |
Correct |
4 ms |
2252 KB |
Output is correct |
18 |
Correct |
3 ms |
2252 KB |
Output is correct |
19 |
Correct |
3 ms |
2252 KB |
Output is correct |
20 |
Correct |
3 ms |
2252 KB |
Output is correct |
21 |
Correct |
4 ms |
2380 KB |
Output is correct |
22 |
Correct |
4 ms |
2252 KB |
Output is correct |
23 |
Correct |
3 ms |
2252 KB |
Output is correct |
24 |
Correct |
3 ms |
2252 KB |
Output is correct |
25 |
Correct |
3 ms |
2380 KB |
Output is correct |
26 |
Correct |
3 ms |
2336 KB |
Output is correct |
27 |
Correct |
3 ms |
2380 KB |
Output is correct |
28 |
Correct |
3 ms |
2252 KB |
Output is correct |
29 |
Correct |
3 ms |
2380 KB |
Output is correct |
30 |
Correct |
3 ms |
2380 KB |
Output is correct |
31 |
Correct |
3 ms |
2380 KB |
Output is correct |
32 |
Correct |
3 ms |
2252 KB |
Output is correct |
33 |
Correct |
4 ms |
2380 KB |
Output is correct |
34 |
Correct |
3 ms |
2380 KB |
Output is correct |
35 |
Correct |
3 ms |
2252 KB |
Output is correct |
36 |
Correct |
3 ms |
2380 KB |
Output is correct |
37 |
Correct |
3 ms |
2380 KB |
Output is correct |
38 |
Correct |
4 ms |
2380 KB |
Output is correct |
39 |
Correct |
4 ms |
2332 KB |
Output is correct |
40 |
Correct |
4 ms |
2380 KB |
Output is correct |
41 |
Correct |
3 ms |
2380 KB |
Output is correct |
42 |
Correct |
3 ms |
2252 KB |
Output is correct |
43 |
Correct |
3 ms |
2252 KB |
Output is correct |
44 |
Correct |
3 ms |
2252 KB |
Output is correct |
45 |
Correct |
3 ms |
2380 KB |
Output is correct |
46 |
Correct |
3 ms |
2380 KB |
Output is correct |
47 |
Correct |
3 ms |
2252 KB |
Output is correct |
48 |
Correct |
4 ms |
2380 KB |
Output is correct |
49 |
Correct |
3 ms |
2380 KB |
Output is correct |
50 |
Correct |
3 ms |
2380 KB |
Output is correct |
51 |
Correct |
3 ms |
2340 KB |
Output is correct |
52 |
Correct |
3 ms |
2380 KB |
Output is correct |
53 |
Correct |
4 ms |
2252 KB |
Output is correct |
54 |
Correct |
3 ms |
2316 KB |
Output is correct |
55 |
Correct |
3 ms |
2380 KB |
Output is correct |
56 |
Correct |
3 ms |
2252 KB |
Output is correct |
57 |
Correct |
3 ms |
2380 KB |
Output is correct |
58 |
Correct |
3 ms |
2252 KB |
Output is correct |
59 |
Correct |
4 ms |
2252 KB |
Output is correct |
60 |
Correct |
6 ms |
2704 KB |
Output is correct |
61 |
Correct |
7 ms |
2508 KB |
Output is correct |
62 |
Correct |
4 ms |
2636 KB |
Output is correct |
63 |
Correct |
7 ms |
3064 KB |
Output is correct |
64 |
Correct |
6 ms |
3532 KB |
Output is correct |
65 |
Correct |
6 ms |
2892 KB |
Output is correct |
66 |
Correct |
6 ms |
2892 KB |
Output is correct |
67 |
Correct |
44 ms |
3472 KB |
Output is correct |
68 |
Correct |
5 ms |
2616 KB |
Output is correct |
69 |
Correct |
4 ms |
2508 KB |
Output is correct |
70 |
Correct |
7 ms |
2636 KB |
Output is correct |
71 |
Correct |
5 ms |
2636 KB |
Output is correct |
72 |
Correct |
6 ms |
2636 KB |
Output is correct |
73 |
Correct |
62 ms |
2732 KB |
Output is correct |
74 |
Correct |
260 ms |
3148 KB |
Output is correct |
75 |
Correct |
109 ms |
2892 KB |
Output is correct |
76 |
Correct |
9 ms |
3020 KB |
Output is correct |
77 |
Correct |
6 ms |
2508 KB |
Output is correct |
78 |
Correct |
22 ms |
2600 KB |
Output is correct |
79 |
Correct |
7 ms |
2648 KB |
Output is correct |
80 |
Correct |
180 ms |
2892 KB |
Output is correct |
81 |
Correct |
201 ms |
3000 KB |
Output is correct |
82 |
Correct |
94 ms |
2892 KB |
Output is correct |
83 |
Correct |
99 ms |
3200 KB |
Output is correct |
84 |
Correct |
5 ms |
2764 KB |
Output is correct |
85 |
Correct |
269 ms |
3176 KB |
Output is correct |
86 |
Correct |
8 ms |
3040 KB |
Output is correct |
87 |
Correct |
11 ms |
3148 KB |
Output is correct |
88 |
Correct |
8 ms |
3148 KB |
Output is correct |
89 |
Correct |
6 ms |
3020 KB |
Output is correct |
90 |
Correct |
35 ms |
2636 KB |
Output is correct |
91 |
Correct |
72 ms |
3148 KB |
Output is correct |
92 |
Correct |
212 ms |
3348 KB |
Output is correct |
93 |
Correct |
20 ms |
3148 KB |
Output is correct |
94 |
Correct |
8 ms |
2892 KB |
Output is correct |
95 |
Correct |
20 ms |
2764 KB |
Output is correct |
96 |
Correct |
8 ms |
2620 KB |
Output is correct |
97 |
Correct |
70 ms |
2776 KB |
Output is correct |
98 |
Correct |
79 ms |
2772 KB |
Output is correct |
99 |
Correct |
54 ms |
2764 KB |
Output is correct |
100 |
Correct |
187 ms |
3064 KB |
Output is correct |
101 |
Correct |
33 ms |
3020 KB |
Output is correct |
102 |
Correct |
81 ms |
3148 KB |
Output is correct |
103 |
Correct |
6 ms |
3020 KB |
Output is correct |
104 |
Correct |
8 ms |
3148 KB |
Output is correct |
105 |
Correct |
8 ms |
3224 KB |
Output is correct |
106 |
Correct |
7 ms |
2892 KB |
Output is correct |
107 |
Correct |
7 ms |
3276 KB |
Output is correct |
108 |
Correct |
6 ms |
3020 KB |
Output is correct |
109 |
Correct |
7 ms |
3020 KB |
Output is correct |
110 |
Correct |
12 ms |
3148 KB |
Output is correct |
111 |
Correct |
6 ms |
3020 KB |
Output is correct |
112 |
Correct |
7 ms |
3272 KB |
Output is correct |
113 |
Correct |
7 ms |
3020 KB |
Output is correct |
114 |
Correct |
6 ms |
3148 KB |
Output is correct |
115 |
Correct |
6 ms |
3020 KB |
Output is correct |
116 |
Correct |
7 ms |
3276 KB |
Output is correct |
117 |
Correct |
6 ms |
2972 KB |
Output is correct |
118 |
Correct |
7 ms |
3272 KB |
Output is correct |
119 |
Correct |
6 ms |
3072 KB |
Output is correct |
120 |
Correct |
6 ms |
3276 KB |
Output is correct |
121 |
Correct |
198 ms |
3148 KB |
Output is correct |
122 |
Correct |
200 ms |
3148 KB |
Output is correct |
123 |
Correct |
101 ms |
3132 KB |
Output is correct |
124 |
Correct |
9 ms |
3248 KB |
Output is correct |
125 |
Correct |
6 ms |
2892 KB |
Output is correct |
126 |
Correct |
28 ms |
2764 KB |
Output is correct |
127 |
Correct |
320 ms |
3376 KB |
Output is correct |
128 |
Correct |
3 ms |
2252 KB |
Output is correct |
129 |
Correct |
146 ms |
18276 KB |
Output is correct |
130 |
Correct |
216 ms |
27652 KB |
Output is correct |
131 |
Correct |
143 ms |
30024 KB |
Output is correct |
132 |
Correct |
126 ms |
16840 KB |
Output is correct |
133 |
Partially correct |
109 ms |
19404 KB |
Output is partially correct |
134 |
Partially correct |
121 ms |
19368 KB |
Output is partially correct |
135 |
Correct |
173 ms |
16756 KB |
Output is correct |
136 |
Correct |
217 ms |
20828 KB |
Output is correct |
137 |
Partially correct |
142 ms |
18020 KB |
Output is partially correct |
138 |
Partially correct |
131 ms |
25988 KB |
Output is partially correct |
139 |
Correct |
436 ms |
43428 KB |
Output is correct |
140 |
Partially correct |
480 ms |
48468 KB |
Output is partially correct |
141 |
Correct |
393 ms |
38984 KB |
Output is correct |
142 |
Correct |
613 ms |
52112 KB |
Output is correct |
143 |
Correct |
536 ms |
50928 KB |
Output is correct |
144 |
Correct |
498 ms |
46744 KB |
Output is correct |
145 |
Partially correct |
494 ms |
60172 KB |
Output is partially correct |
146 |
Partially correct |
349 ms |
41836 KB |
Output is partially correct |
147 |
Partially correct |
405 ms |
56656 KB |
Output is partially correct |
148 |
Correct |
701 ms |
38512 KB |
Output is correct |
149 |
Partially correct |
149 ms |
16068 KB |
Output is partially correct |
150 |
Correct |
128 ms |
18508 KB |
Output is correct |
151 |
Correct |
195 ms |
22580 KB |
Output is correct |
152 |
Correct |
120 ms |
17804 KB |
Output is correct |
153 |
Correct |
149 ms |
17580 KB |
Output is correct |
154 |
Correct |
155 ms |
16912 KB |
Output is correct |
155 |
Correct |
135 ms |
21480 KB |
Output is correct |
156 |
Partially correct |
95 ms |
19716 KB |
Output is partially correct |
157 |
Correct |
124 ms |
16400 KB |
Output is correct |
158 |
Partially correct |
110 ms |
18028 KB |
Output is partially correct |
159 |
Partially correct |
92 ms |
23344 KB |
Output is partially correct |
160 |
Partially correct |
287 ms |
34228 KB |
Output is partially correct |
161 |
Partially correct |
426 ms |
48364 KB |
Output is partially correct |
162 |
Correct |
674 ms |
65440 KB |
Output is correct |
163 |
Correct |
572 ms |
57252 KB |
Output is correct |
164 |
Partially correct |
493 ms |
55860 KB |
Output is partially correct |
165 |
Partially correct |
562 ms |
40928 KB |
Output is partially correct |
166 |
Partially correct |
477 ms |
40920 KB |
Output is partially correct |
167 |
Correct |
726 ms |
59440 KB |
Output is correct |
168 |
Partially correct |
385 ms |
43288 KB |
Output is partially correct |
169 |
Partially correct |
347 ms |
45072 KB |
Output is partially correct |
170 |
Partially correct |
282 ms |
38956 KB |
Output is partially correct |
171 |
Correct |
453 ms |
31028 KB |
Output is correct |
172 |
Correct |
653 ms |
41036 KB |
Output is correct |
173 |
Correct |
523 ms |
50732 KB |
Output is correct |
174 |
Correct |
432 ms |
51744 KB |
Output is correct |
175 |
Correct |
481 ms |
47152 KB |
Output is correct |
176 |
Correct |
412 ms |
46260 KB |
Output is correct |
177 |
Correct |
417 ms |
46348 KB |
Output is correct |
178 |
Correct |
530 ms |
64328 KB |
Output is correct |
179 |
Partially correct |
304 ms |
44868 KB |
Output is partially correct |
180 |
Partially correct |
317 ms |
45240 KB |
Output is partially correct |
181 |
Partially correct |
280 ms |
29008 KB |
Output is partially correct |
182 |
Correct |
424 ms |
45904 KB |
Output is correct |
183 |
Correct |
433 ms |
55424 KB |
Output is correct |
184 |
Partially correct |
355 ms |
37888 KB |
Output is partially correct |
185 |
Partially correct |
419 ms |
35908 KB |
Output is partially correct |
186 |
Partially correct |
278 ms |
32632 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2380 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2380 KB |
Output is correct |
5 |
Correct |
3 ms |
2380 KB |
Output is correct |
6 |
Correct |
3 ms |
2380 KB |
Output is correct |
7 |
Correct |
3 ms |
2380 KB |
Output is correct |
8 |
Correct |
3 ms |
2380 KB |
Output is correct |
9 |
Correct |
3 ms |
2380 KB |
Output is correct |
10 |
Correct |
3 ms |
2252 KB |
Output is correct |
11 |
Correct |
3 ms |
2316 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2380 KB |
Output is correct |
14 |
Correct |
3 ms |
2380 KB |
Output is correct |
15 |
Correct |
4 ms |
2304 KB |
Output is correct |
16 |
Correct |
4 ms |
2252 KB |
Output is correct |
17 |
Correct |
4 ms |
2252 KB |
Output is correct |
18 |
Correct |
3 ms |
2252 KB |
Output is correct |
19 |
Correct |
3 ms |
2252 KB |
Output is correct |
20 |
Correct |
3 ms |
2252 KB |
Output is correct |
21 |
Correct |
4 ms |
2380 KB |
Output is correct |
22 |
Correct |
4 ms |
2252 KB |
Output is correct |
23 |
Correct |
3 ms |
2252 KB |
Output is correct |
24 |
Correct |
3 ms |
2252 KB |
Output is correct |
25 |
Correct |
3 ms |
2380 KB |
Output is correct |
26 |
Correct |
3 ms |
2336 KB |
Output is correct |
27 |
Correct |
3 ms |
2380 KB |
Output is correct |
28 |
Correct |
3 ms |
2252 KB |
Output is correct |
29 |
Correct |
3 ms |
2380 KB |
Output is correct |
30 |
Correct |
3 ms |
2380 KB |
Output is correct |
31 |
Correct |
3 ms |
2380 KB |
Output is correct |
32 |
Correct |
3 ms |
2252 KB |
Output is correct |
33 |
Correct |
4 ms |
2380 KB |
Output is correct |
34 |
Correct |
3 ms |
2380 KB |
Output is correct |
35 |
Correct |
3 ms |
2252 KB |
Output is correct |
36 |
Correct |
3 ms |
2380 KB |
Output is correct |
37 |
Correct |
3 ms |
2380 KB |
Output is correct |
38 |
Correct |
4 ms |
2380 KB |
Output is correct |
39 |
Correct |
4 ms |
2332 KB |
Output is correct |
40 |
Correct |
4 ms |
2380 KB |
Output is correct |
41 |
Correct |
3 ms |
2380 KB |
Output is correct |
42 |
Correct |
3 ms |
2252 KB |
Output is correct |
43 |
Correct |
3 ms |
2252 KB |
Output is correct |
44 |
Correct |
3 ms |
2252 KB |
Output is correct |
45 |
Correct |
3 ms |
2380 KB |
Output is correct |
46 |
Correct |
3 ms |
2380 KB |
Output is correct |
47 |
Correct |
3 ms |
2252 KB |
Output is correct |
48 |
Correct |
4 ms |
2380 KB |
Output is correct |
49 |
Correct |
3 ms |
2380 KB |
Output is correct |
50 |
Correct |
3 ms |
2380 KB |
Output is correct |
51 |
Correct |
3 ms |
2340 KB |
Output is correct |
52 |
Correct |
3 ms |
2380 KB |
Output is correct |
53 |
Correct |
4 ms |
2252 KB |
Output is correct |
54 |
Correct |
3 ms |
2316 KB |
Output is correct |
55 |
Correct |
3 ms |
2380 KB |
Output is correct |
56 |
Correct |
3 ms |
2252 KB |
Output is correct |
57 |
Correct |
3 ms |
2380 KB |
Output is correct |
58 |
Correct |
3 ms |
2252 KB |
Output is correct |
59 |
Correct |
4 ms |
2252 KB |
Output is correct |
60 |
Correct |
6 ms |
2704 KB |
Output is correct |
61 |
Correct |
7 ms |
2508 KB |
Output is correct |
62 |
Correct |
4 ms |
2636 KB |
Output is correct |
63 |
Correct |
7 ms |
3064 KB |
Output is correct |
64 |
Correct |
6 ms |
3532 KB |
Output is correct |
65 |
Correct |
6 ms |
2892 KB |
Output is correct |
66 |
Correct |
6 ms |
2892 KB |
Output is correct |
67 |
Correct |
44 ms |
3472 KB |
Output is correct |
68 |
Correct |
5 ms |
2616 KB |
Output is correct |
69 |
Correct |
4 ms |
2508 KB |
Output is correct |
70 |
Correct |
7 ms |
2636 KB |
Output is correct |
71 |
Correct |
5 ms |
2636 KB |
Output is correct |
72 |
Correct |
6 ms |
2636 KB |
Output is correct |
73 |
Correct |
62 ms |
2732 KB |
Output is correct |
74 |
Correct |
260 ms |
3148 KB |
Output is correct |
75 |
Correct |
109 ms |
2892 KB |
Output is correct |
76 |
Correct |
9 ms |
3020 KB |
Output is correct |
77 |
Correct |
6 ms |
2508 KB |
Output is correct |
78 |
Correct |
22 ms |
2600 KB |
Output is correct |
79 |
Correct |
7 ms |
2648 KB |
Output is correct |
80 |
Correct |
180 ms |
2892 KB |
Output is correct |
81 |
Correct |
201 ms |
3000 KB |
Output is correct |
82 |
Correct |
94 ms |
2892 KB |
Output is correct |
83 |
Correct |
99 ms |
3200 KB |
Output is correct |
84 |
Correct |
5 ms |
2764 KB |
Output is correct |
85 |
Correct |
269 ms |
3176 KB |
Output is correct |
86 |
Correct |
8 ms |
3040 KB |
Output is correct |
87 |
Correct |
11 ms |
3148 KB |
Output is correct |
88 |
Correct |
8 ms |
3148 KB |
Output is correct |
89 |
Correct |
6 ms |
3020 KB |
Output is correct |
90 |
Correct |
35 ms |
2636 KB |
Output is correct |
91 |
Correct |
72 ms |
3148 KB |
Output is correct |
92 |
Correct |
212 ms |
3348 KB |
Output is correct |
93 |
Correct |
20 ms |
3148 KB |
Output is correct |
94 |
Correct |
8 ms |
2892 KB |
Output is correct |
95 |
Correct |
20 ms |
2764 KB |
Output is correct |
96 |
Correct |
8 ms |
2620 KB |
Output is correct |
97 |
Correct |
70 ms |
2776 KB |
Output is correct |
98 |
Correct |
79 ms |
2772 KB |
Output is correct |
99 |
Correct |
54 ms |
2764 KB |
Output is correct |
100 |
Correct |
187 ms |
3064 KB |
Output is correct |
101 |
Correct |
33 ms |
3020 KB |
Output is correct |
102 |
Correct |
81 ms |
3148 KB |
Output is correct |
103 |
Correct |
6 ms |
3020 KB |
Output is correct |
104 |
Correct |
8 ms |
3148 KB |
Output is correct |
105 |
Correct |
8 ms |
3224 KB |
Output is correct |
106 |
Correct |
7 ms |
2892 KB |
Output is correct |
107 |
Correct |
7 ms |
3276 KB |
Output is correct |
108 |
Correct |
6 ms |
3020 KB |
Output is correct |
109 |
Correct |
7 ms |
3020 KB |
Output is correct |
110 |
Correct |
12 ms |
3148 KB |
Output is correct |
111 |
Correct |
6 ms |
3020 KB |
Output is correct |
112 |
Correct |
7 ms |
3272 KB |
Output is correct |
113 |
Correct |
7 ms |
3020 KB |
Output is correct |
114 |
Correct |
6 ms |
3148 KB |
Output is correct |
115 |
Correct |
6 ms |
3020 KB |
Output is correct |
116 |
Correct |
7 ms |
3276 KB |
Output is correct |
117 |
Correct |
6 ms |
2972 KB |
Output is correct |
118 |
Correct |
7 ms |
3272 KB |
Output is correct |
119 |
Correct |
6 ms |
3072 KB |
Output is correct |
120 |
Correct |
6 ms |
3276 KB |
Output is correct |
121 |
Correct |
198 ms |
3148 KB |
Output is correct |
122 |
Correct |
200 ms |
3148 KB |
Output is correct |
123 |
Correct |
101 ms |
3132 KB |
Output is correct |
124 |
Correct |
9 ms |
3248 KB |
Output is correct |
125 |
Correct |
6 ms |
2892 KB |
Output is correct |
126 |
Correct |
28 ms |
2764 KB |
Output is correct |
127 |
Correct |
320 ms |
3376 KB |
Output is correct |
128 |
Correct |
3 ms |
2252 KB |
Output is correct |
129 |
Correct |
146 ms |
18276 KB |
Output is correct |
130 |
Correct |
216 ms |
27652 KB |
Output is correct |
131 |
Correct |
143 ms |
30024 KB |
Output is correct |
132 |
Correct |
126 ms |
16840 KB |
Output is correct |
133 |
Partially correct |
109 ms |
19404 KB |
Output is partially correct |
134 |
Partially correct |
121 ms |
19368 KB |
Output is partially correct |
135 |
Correct |
173 ms |
16756 KB |
Output is correct |
136 |
Correct |
217 ms |
20828 KB |
Output is correct |
137 |
Partially correct |
142 ms |
18020 KB |
Output is partially correct |
138 |
Partially correct |
131 ms |
25988 KB |
Output is partially correct |
139 |
Correct |
436 ms |
43428 KB |
Output is correct |
140 |
Partially correct |
480 ms |
48468 KB |
Output is partially correct |
141 |
Correct |
393 ms |
38984 KB |
Output is correct |
142 |
Correct |
613 ms |
52112 KB |
Output is correct |
143 |
Correct |
536 ms |
50928 KB |
Output is correct |
144 |
Correct |
498 ms |
46744 KB |
Output is correct |
145 |
Partially correct |
494 ms |
60172 KB |
Output is partially correct |
146 |
Partially correct |
349 ms |
41836 KB |
Output is partially correct |
147 |
Partially correct |
405 ms |
56656 KB |
Output is partially correct |
148 |
Correct |
701 ms |
38512 KB |
Output is correct |
149 |
Partially correct |
149 ms |
16068 KB |
Output is partially correct |
150 |
Correct |
128 ms |
18508 KB |
Output is correct |
151 |
Correct |
195 ms |
22580 KB |
Output is correct |
152 |
Correct |
120 ms |
17804 KB |
Output is correct |
153 |
Correct |
149 ms |
17580 KB |
Output is correct |
154 |
Correct |
155 ms |
16912 KB |
Output is correct |
155 |
Correct |
135 ms |
21480 KB |
Output is correct |
156 |
Partially correct |
95 ms |
19716 KB |
Output is partially correct |
157 |
Correct |
124 ms |
16400 KB |
Output is correct |
158 |
Partially correct |
110 ms |
18028 KB |
Output is partially correct |
159 |
Partially correct |
92 ms |
23344 KB |
Output is partially correct |
160 |
Partially correct |
287 ms |
34228 KB |
Output is partially correct |
161 |
Partially correct |
426 ms |
48364 KB |
Output is partially correct |
162 |
Correct |
674 ms |
65440 KB |
Output is correct |
163 |
Correct |
572 ms |
57252 KB |
Output is correct |
164 |
Partially correct |
493 ms |
55860 KB |
Output is partially correct |
165 |
Partially correct |
562 ms |
40928 KB |
Output is partially correct |
166 |
Partially correct |
477 ms |
40920 KB |
Output is partially correct |
167 |
Correct |
726 ms |
59440 KB |
Output is correct |
168 |
Partially correct |
385 ms |
43288 KB |
Output is partially correct |
169 |
Partially correct |
347 ms |
45072 KB |
Output is partially correct |
170 |
Partially correct |
282 ms |
38956 KB |
Output is partially correct |
171 |
Correct |
453 ms |
31028 KB |
Output is correct |
172 |
Correct |
653 ms |
41036 KB |
Output is correct |
173 |
Correct |
523 ms |
50732 KB |
Output is correct |
174 |
Correct |
432 ms |
51744 KB |
Output is correct |
175 |
Correct |
481 ms |
47152 KB |
Output is correct |
176 |
Correct |
412 ms |
46260 KB |
Output is correct |
177 |
Correct |
417 ms |
46348 KB |
Output is correct |
178 |
Correct |
530 ms |
64328 KB |
Output is correct |
179 |
Partially correct |
304 ms |
44868 KB |
Output is partially correct |
180 |
Partially correct |
317 ms |
45240 KB |
Output is partially correct |
181 |
Partially correct |
280 ms |
29008 KB |
Output is partially correct |
182 |
Correct |
424 ms |
45904 KB |
Output is correct |
183 |
Correct |
433 ms |
55424 KB |
Output is correct |
184 |
Partially correct |
355 ms |
37888 KB |
Output is partially correct |
185 |
Partially correct |
419 ms |
35908 KB |
Output is partially correct |
186 |
Partially correct |
278 ms |
32632 KB |
Output is partially correct |
187 |
Runtime error |
306 ms |
41240 KB |
Execution killed with signal 11 |
188 |
Halted |
0 ms |
0 KB |
- |