#include <stdio.h>
#define K 100000
#define N (K * 6)
#define MD 998244353
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
unsigned int Z = 12345;
int rand_() {
return (Z *= 3) >> 1;
}
int xx[N], yy[N], dd[N], ww[N], ii[N], dp[N][2], n; char trap[N], visited[N][2];
void sort(int *ii, int l, int r) {
while (l < r) {
int i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;
while (j < k) {
int c = dd[ii[j]] != dd[i_] ? dd[ii[j]] - dd[i_] : xx[ii[j]] - xx[i_];
if (c == 0)
j++;
else if (c < 0) {
tmp = ii[i], ii[i] = ii[j], ii[j] = tmp;
i++, j++;
} else {
k--;
tmp = ii[j], ii[j] = ii[k], ii[k] = tmp;
}
}
sort(ii, l, i);
l = k;
}
}
int solve(int x, int y, int turn) {
int d, lower, upper, i;
d = x - y;
lower = -1, upper = n;
while (upper - lower > 1) {
i = (lower + upper) / 2;
if (dd[ii[i]] < d || dd[ii[i]] == d && xx[ii[i]] < x)
lower = i;
else
upper = i;
}
if (upper == n || dd[i = ii[upper]] != d)
return 0;
x = xx[i], y = yy[i];
if (!visited[i][turn])
visited[i][turn] = 1, dp[i][turn] = trap[i] ? ww[i] : (turn == 0 ? min(solve(x + 1, y, 1), solve(x, y + 1, 1)) : max(solve(x + 1, y, 0), solve(x, y + 1, 0)));
return dp[i][turn];
}
int main() {
int n_, k, i, ans;
scanf("%*d%*d%d", &k);
n = 0;
while (k--) {
int x, y, w;
scanf("%d%d%d", &x, &y, &w);
xx[n] = x, yy[n] = y, ww[n] = w, trap[n] = 1, n++;
if (x > 1)
xx[n] = x - 1, yy[n] = y, ww[n] = 0, n++;
if (y > 1)
xx[n] = x, yy[n] = y - 1, ww[n] = 0, n++;
if (x > 2)
xx[n] = x - 2, yy[n] = y, ww[n] = 0, n++;
if (x > 1 && y > 1)
xx[n] = x - 1, yy[n] = y - 1, ww[n] = 0, n++;
if (y > 2)
xx[n] = x, yy[n] = y - 2, ww[n] = 0, n++;
}
for (i = 0; i < n; i++)
dd[i] = xx[i] - yy[i];
for (i = 0; i < n; i++)
ii[i] = i;
sort(ii, 0, n);
n_ = 0;
for (i = 0; i < n; i++)
if (n_ == 0 || xx[ii[n_ - 1]] != xx[ii[i]] || yy[ii[n_ - 1]] != yy[ii[i]])
ii[n_++] = ii[i];
else if (trap[ii[i]])
ii[n_ - 1] = ii[i];
n = n_;
ans = 0;
for (i = 0; i < n; i++)
ans = (ans + (long long) solve(xx[ii[i]], yy[ii[i]], 0) * (i == 0 || dd[ii[i]] != dd[ii[i - 1]] ? min(xx[ii[i]], yy[ii[i]]) : xx[ii[i]] - xx[ii[i - 1]])) % MD;
if (ans < 0)
ans += MD;
printf("%d\n", ans);
return 0;
}
Compilation message
golf.c: In function 'solve':
golf.c:47:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
47 | if (dd[ii[i]] < d || dd[ii[i]] == d && xx[ii[i]] < x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
golf.c: In function 'main':
golf.c:63:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
63 | scanf("%*d%*d%d", &k);
| ^~~~~~~~~~~~~~~~~~~~~
golf.c:68:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
68 | scanf("%d%d%d", &x, &y, &w);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
1 ms |
12636 KB |
Output is correct |
3 |
Correct |
2 ms |
12636 KB |
Output is correct |
4 |
Correct |
2 ms |
12636 KB |
Output is correct |
5 |
Correct |
1 ms |
12716 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12636 KB |
Output is correct |
8 |
Correct |
1 ms |
12712 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
314 ms |
20764 KB |
Output is correct |
11 |
Correct |
303 ms |
20400 KB |
Output is correct |
12 |
Correct |
312 ms |
20504 KB |
Output is correct |
13 |
Correct |
300 ms |
20216 KB |
Output is correct |
14 |
Correct |
259 ms |
20380 KB |
Output is correct |
15 |
Correct |
265 ms |
20388 KB |
Output is correct |
16 |
Correct |
2 ms |
12636 KB |
Output is correct |
17 |
Correct |
2 ms |
12636 KB |
Output is correct |
18 |
Correct |
7 ms |
12828 KB |
Output is correct |
19 |
Correct |
7 ms |
12636 KB |
Output is correct |
20 |
Correct |
2 ms |
12724 KB |
Output is correct |
21 |
Correct |
3 ms |
12636 KB |
Output is correct |
22 |
Correct |
295 ms |
20384 KB |
Output is correct |
23 |
Correct |
188 ms |
20256 KB |
Output is correct |
24 |
Correct |
209 ms |
20308 KB |
Output is correct |
25 |
Correct |
172 ms |
20248 KB |
Output is correct |
26 |
Correct |
243 ms |
20208 KB |
Output is correct |
27 |
Correct |
236 ms |
20308 KB |
Output is correct |
28 |
Correct |
1 ms |
12636 KB |
Output is correct |
29 |
Correct |
2 ms |
12636 KB |
Output is correct |
30 |
Correct |
2 ms |
12636 KB |
Output is correct |
31 |
Correct |
2 ms |
12716 KB |
Output is correct |
32 |
Correct |
233 ms |
20132 KB |
Output is correct |
33 |
Correct |
270 ms |
20384 KB |
Output is correct |
34 |
Correct |
143 ms |
19644 KB |
Output is correct |
35 |
Correct |
163 ms |
19540 KB |
Output is correct |
36 |
Correct |
131 ms |
19552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
2 ms |
12636 KB |
Output is correct |
3 |
Correct |
27 ms |
15124 KB |
Output is correct |
4 |
Correct |
203 ms |
19956 KB |
Output is correct |
5 |
Correct |
219 ms |
20036 KB |
Output is correct |
6 |
Correct |
246 ms |
20148 KB |
Output is correct |
7 |
Correct |
213 ms |
20252 KB |
Output is correct |
8 |
Correct |
124 ms |
19484 KB |
Output is correct |
9 |
Correct |
172 ms |
19796 KB |
Output is correct |
10 |
Correct |
200 ms |
20056 KB |
Output is correct |
11 |
Correct |
216 ms |
20052 KB |
Output is correct |
12 |
Correct |
225 ms |
20332 KB |
Output is correct |
13 |
Correct |
210 ms |
20008 KB |
Output is correct |
14 |
Correct |
203 ms |
20136 KB |
Output is correct |
15 |
Correct |
226 ms |
20344 KB |
Output is correct |
16 |
Correct |
209 ms |
20344 KB |
Output is correct |
17 |
Correct |
218 ms |
20300 KB |
Output is correct |
18 |
Correct |
162 ms |
20340 KB |
Output is correct |
19 |
Correct |
230 ms |
20348 KB |
Output is correct |
20 |
Correct |
186 ms |
20340 KB |
Output is correct |
21 |
Correct |
2 ms |
12636 KB |
Output is correct |
22 |
Correct |
1 ms |
12724 KB |
Output is correct |
23 |
Correct |
2 ms |
12636 KB |
Output is correct |
24 |
Correct |
1 ms |
12636 KB |
Output is correct |
25 |
Correct |
2 ms |
12636 KB |
Output is correct |
26 |
Correct |
148 ms |
19548 KB |
Output is correct |
27 |
Correct |
181 ms |
19796 KB |
Output is correct |
28 |
Correct |
115 ms |
19284 KB |
Output is correct |
29 |
Correct |
112 ms |
19284 KB |
Output is correct |
30 |
Correct |
107 ms |
19540 KB |
Output is correct |
31 |
Correct |
127 ms |
19280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
19192 KB |
Output is correct |
2 |
Correct |
59 ms |
18952 KB |
Output is correct |
3 |
Correct |
203 ms |
22952 KB |
Output is correct |
4 |
Correct |
191 ms |
20516 KB |
Output is correct |
5 |
Correct |
240 ms |
24876 KB |
Output is correct |
6 |
Correct |
121 ms |
19636 KB |
Output is correct |
7 |
Correct |
242 ms |
25080 KB |
Output is correct |
8 |
Correct |
280 ms |
25260 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
1 ms |
12636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
1 ms |
12636 KB |
Output is correct |
3 |
Correct |
2 ms |
12636 KB |
Output is correct |
4 |
Correct |
2 ms |
12636 KB |
Output is correct |
5 |
Correct |
1 ms |
12716 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12636 KB |
Output is correct |
8 |
Correct |
1 ms |
12712 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
314 ms |
20764 KB |
Output is correct |
11 |
Correct |
303 ms |
20400 KB |
Output is correct |
12 |
Correct |
312 ms |
20504 KB |
Output is correct |
13 |
Correct |
300 ms |
20216 KB |
Output is correct |
14 |
Correct |
259 ms |
20380 KB |
Output is correct |
15 |
Correct |
265 ms |
20388 KB |
Output is correct |
16 |
Correct |
2 ms |
12636 KB |
Output is correct |
17 |
Correct |
2 ms |
12636 KB |
Output is correct |
18 |
Correct |
7 ms |
12828 KB |
Output is correct |
19 |
Correct |
7 ms |
12636 KB |
Output is correct |
20 |
Correct |
2 ms |
12724 KB |
Output is correct |
21 |
Correct |
3 ms |
12636 KB |
Output is correct |
22 |
Correct |
295 ms |
20384 KB |
Output is correct |
23 |
Correct |
188 ms |
20256 KB |
Output is correct |
24 |
Correct |
209 ms |
20308 KB |
Output is correct |
25 |
Correct |
172 ms |
20248 KB |
Output is correct |
26 |
Correct |
243 ms |
20208 KB |
Output is correct |
27 |
Correct |
236 ms |
20308 KB |
Output is correct |
28 |
Correct |
1 ms |
12636 KB |
Output is correct |
29 |
Correct |
2 ms |
12636 KB |
Output is correct |
30 |
Correct |
2 ms |
12636 KB |
Output is correct |
31 |
Correct |
2 ms |
12716 KB |
Output is correct |
32 |
Correct |
233 ms |
20132 KB |
Output is correct |
33 |
Correct |
270 ms |
20384 KB |
Output is correct |
34 |
Correct |
143 ms |
19644 KB |
Output is correct |
35 |
Correct |
163 ms |
19540 KB |
Output is correct |
36 |
Correct |
131 ms |
19552 KB |
Output is correct |
37 |
Correct |
310 ms |
21540 KB |
Output is correct |
38 |
Correct |
314 ms |
21588 KB |
Output is correct |
39 |
Correct |
291 ms |
21452 KB |
Output is correct |
40 |
Correct |
316 ms |
21696 KB |
Output is correct |
41 |
Correct |
270 ms |
21452 KB |
Output is correct |
42 |
Correct |
186 ms |
21572 KB |
Output is correct |
43 |
Correct |
225 ms |
21444 KB |
Output is correct |
44 |
Correct |
178 ms |
21332 KB |
Output is correct |
45 |
Correct |
233 ms |
21448 KB |
Output is correct |
46 |
Correct |
241 ms |
21332 KB |
Output is correct |
47 |
Correct |
4 ms |
12780 KB |
Output is correct |
48 |
Correct |
5 ms |
12636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
286 ms |
19840 KB |
Output is correct |
2 |
Correct |
266 ms |
19676 KB |
Output is correct |
3 |
Correct |
244 ms |
19460 KB |
Output is correct |
4 |
Correct |
242 ms |
19468 KB |
Output is correct |
5 |
Correct |
13 ms |
12892 KB |
Output is correct |
6 |
Correct |
28 ms |
15232 KB |
Output is correct |
7 |
Correct |
239 ms |
19300 KB |
Output is correct |
8 |
Correct |
221 ms |
19288 KB |
Output is correct |
9 |
Correct |
289 ms |
19540 KB |
Output is correct |
10 |
Correct |
281 ms |
19520 KB |
Output is correct |
11 |
Correct |
295 ms |
19540 KB |
Output is correct |
12 |
Correct |
312 ms |
19628 KB |
Output is correct |
13 |
Correct |
304 ms |
19624 KB |
Output is correct |
14 |
Correct |
299 ms |
19744 KB |
Output is correct |
15 |
Correct |
259 ms |
19792 KB |
Output is correct |
16 |
Correct |
209 ms |
19856 KB |
Output is correct |
17 |
Correct |
268 ms |
19876 KB |
Output is correct |
18 |
Correct |
176 ms |
19804 KB |
Output is correct |
19 |
Correct |
279 ms |
19796 KB |
Output is correct |
20 |
Correct |
232 ms |
19780 KB |
Output is correct |
21 |
Correct |
2 ms |
12636 KB |
Output is correct |
22 |
Correct |
231 ms |
19488 KB |
Output is correct |
23 |
Correct |
266 ms |
19412 KB |
Output is correct |
24 |
Correct |
328 ms |
19796 KB |
Output is correct |
25 |
Correct |
49 ms |
14952 KB |
Output is correct |
26 |
Correct |
63 ms |
15188 KB |
Output is correct |
27 |
Correct |
68 ms |
15420 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
286 ms |
19840 KB |
Output is correct |
2 |
Correct |
266 ms |
19676 KB |
Output is correct |
3 |
Correct |
244 ms |
19460 KB |
Output is correct |
4 |
Correct |
242 ms |
19468 KB |
Output is correct |
5 |
Correct |
13 ms |
12892 KB |
Output is correct |
6 |
Correct |
28 ms |
15232 KB |
Output is correct |
7 |
Correct |
239 ms |
19300 KB |
Output is correct |
8 |
Correct |
221 ms |
19288 KB |
Output is correct |
9 |
Correct |
289 ms |
19540 KB |
Output is correct |
10 |
Correct |
281 ms |
19520 KB |
Output is correct |
11 |
Correct |
295 ms |
19540 KB |
Output is correct |
12 |
Correct |
312 ms |
19628 KB |
Output is correct |
13 |
Correct |
304 ms |
19624 KB |
Output is correct |
14 |
Correct |
299 ms |
19744 KB |
Output is correct |
15 |
Correct |
259 ms |
19792 KB |
Output is correct |
16 |
Correct |
209 ms |
19856 KB |
Output is correct |
17 |
Correct |
268 ms |
19876 KB |
Output is correct |
18 |
Correct |
176 ms |
19804 KB |
Output is correct |
19 |
Correct |
279 ms |
19796 KB |
Output is correct |
20 |
Correct |
232 ms |
19780 KB |
Output is correct |
21 |
Correct |
2 ms |
12636 KB |
Output is correct |
22 |
Correct |
231 ms |
19488 KB |
Output is correct |
23 |
Correct |
266 ms |
19412 KB |
Output is correct |
24 |
Correct |
328 ms |
19796 KB |
Output is correct |
25 |
Correct |
49 ms |
14952 KB |
Output is correct |
26 |
Correct |
63 ms |
15188 KB |
Output is correct |
27 |
Correct |
68 ms |
15420 KB |
Output is correct |
28 |
Correct |
281 ms |
20864 KB |
Output is correct |
29 |
Correct |
238 ms |
20400 KB |
Output is correct |
30 |
Correct |
225 ms |
20128 KB |
Output is correct |
31 |
Correct |
270 ms |
20428 KB |
Output is correct |
32 |
Correct |
249 ms |
20308 KB |
Output is correct |
33 |
Correct |
277 ms |
20728 KB |
Output is correct |
34 |
Correct |
192 ms |
20640 KB |
Output is correct |
35 |
Correct |
235 ms |
20516 KB |
Output is correct |
36 |
Correct |
184 ms |
20712 KB |
Output is correct |
37 |
Correct |
280 ms |
21004 KB |
Output is correct |
38 |
Correct |
233 ms |
20264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
1 ms |
12636 KB |
Output is correct |
3 |
Correct |
2 ms |
12636 KB |
Output is correct |
4 |
Correct |
2 ms |
12636 KB |
Output is correct |
5 |
Correct |
1 ms |
12716 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12636 KB |
Output is correct |
8 |
Correct |
1 ms |
12712 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
314 ms |
20764 KB |
Output is correct |
11 |
Correct |
303 ms |
20400 KB |
Output is correct |
12 |
Correct |
312 ms |
20504 KB |
Output is correct |
13 |
Correct |
300 ms |
20216 KB |
Output is correct |
14 |
Correct |
259 ms |
20380 KB |
Output is correct |
15 |
Correct |
265 ms |
20388 KB |
Output is correct |
16 |
Correct |
2 ms |
12636 KB |
Output is correct |
17 |
Correct |
2 ms |
12636 KB |
Output is correct |
18 |
Correct |
7 ms |
12828 KB |
Output is correct |
19 |
Correct |
7 ms |
12636 KB |
Output is correct |
20 |
Correct |
2 ms |
12724 KB |
Output is correct |
21 |
Correct |
3 ms |
12636 KB |
Output is correct |
22 |
Correct |
295 ms |
20384 KB |
Output is correct |
23 |
Correct |
188 ms |
20256 KB |
Output is correct |
24 |
Correct |
209 ms |
20308 KB |
Output is correct |
25 |
Correct |
172 ms |
20248 KB |
Output is correct |
26 |
Correct |
243 ms |
20208 KB |
Output is correct |
27 |
Correct |
236 ms |
20308 KB |
Output is correct |
28 |
Correct |
1 ms |
12636 KB |
Output is correct |
29 |
Correct |
2 ms |
12636 KB |
Output is correct |
30 |
Correct |
2 ms |
12636 KB |
Output is correct |
31 |
Correct |
2 ms |
12716 KB |
Output is correct |
32 |
Correct |
233 ms |
20132 KB |
Output is correct |
33 |
Correct |
270 ms |
20384 KB |
Output is correct |
34 |
Correct |
143 ms |
19644 KB |
Output is correct |
35 |
Correct |
163 ms |
19540 KB |
Output is correct |
36 |
Correct |
131 ms |
19552 KB |
Output is correct |
37 |
Correct |
60 ms |
19192 KB |
Output is correct |
38 |
Correct |
59 ms |
18952 KB |
Output is correct |
39 |
Correct |
203 ms |
22952 KB |
Output is correct |
40 |
Correct |
191 ms |
20516 KB |
Output is correct |
41 |
Correct |
240 ms |
24876 KB |
Output is correct |
42 |
Correct |
121 ms |
19636 KB |
Output is correct |
43 |
Correct |
242 ms |
25080 KB |
Output is correct |
44 |
Correct |
280 ms |
25260 KB |
Output is correct |
45 |
Correct |
1 ms |
12636 KB |
Output is correct |
46 |
Correct |
1 ms |
12636 KB |
Output is correct |
47 |
Correct |
286 ms |
19840 KB |
Output is correct |
48 |
Correct |
266 ms |
19676 KB |
Output is correct |
49 |
Correct |
244 ms |
19460 KB |
Output is correct |
50 |
Correct |
242 ms |
19468 KB |
Output is correct |
51 |
Correct |
13 ms |
12892 KB |
Output is correct |
52 |
Correct |
28 ms |
15232 KB |
Output is correct |
53 |
Correct |
239 ms |
19300 KB |
Output is correct |
54 |
Correct |
221 ms |
19288 KB |
Output is correct |
55 |
Correct |
289 ms |
19540 KB |
Output is correct |
56 |
Correct |
281 ms |
19520 KB |
Output is correct |
57 |
Correct |
295 ms |
19540 KB |
Output is correct |
58 |
Correct |
312 ms |
19628 KB |
Output is correct |
59 |
Correct |
304 ms |
19624 KB |
Output is correct |
60 |
Correct |
299 ms |
19744 KB |
Output is correct |
61 |
Correct |
259 ms |
19792 KB |
Output is correct |
62 |
Correct |
209 ms |
19856 KB |
Output is correct |
63 |
Correct |
268 ms |
19876 KB |
Output is correct |
64 |
Correct |
176 ms |
19804 KB |
Output is correct |
65 |
Correct |
279 ms |
19796 KB |
Output is correct |
66 |
Correct |
232 ms |
19780 KB |
Output is correct |
67 |
Correct |
2 ms |
12636 KB |
Output is correct |
68 |
Correct |
231 ms |
19488 KB |
Output is correct |
69 |
Correct |
266 ms |
19412 KB |
Output is correct |
70 |
Correct |
328 ms |
19796 KB |
Output is correct |
71 |
Correct |
49 ms |
14952 KB |
Output is correct |
72 |
Correct |
63 ms |
15188 KB |
Output is correct |
73 |
Correct |
68 ms |
15420 KB |
Output is correct |
74 |
Correct |
305 ms |
20760 KB |
Output is correct |
75 |
Correct |
265 ms |
20492 KB |
Output is correct |
76 |
Correct |
257 ms |
20384 KB |
Output is correct |
77 |
Correct |
246 ms |
20288 KB |
Output is correct |
78 |
Correct |
11 ms |
13144 KB |
Output is correct |
79 |
Correct |
28 ms |
15320 KB |
Output is correct |
80 |
Correct |
237 ms |
20364 KB |
Output is correct |
81 |
Correct |
256 ms |
20188 KB |
Output is correct |
82 |
Correct |
283 ms |
20620 KB |
Output is correct |
83 |
Correct |
289 ms |
20308 KB |
Output is correct |
84 |
Correct |
295 ms |
20564 KB |
Output is correct |
85 |
Correct |
307 ms |
20564 KB |
Output is correct |
86 |
Correct |
297 ms |
20552 KB |
Output is correct |
87 |
Correct |
305 ms |
20548 KB |
Output is correct |
88 |
Correct |
270 ms |
20564 KB |
Output is correct |
89 |
Correct |
180 ms |
20568 KB |
Output is correct |
90 |
Correct |
245 ms |
20752 KB |
Output is correct |
91 |
Correct |
176 ms |
20632 KB |
Output is correct |
92 |
Correct |
286 ms |
20900 KB |
Output is correct |
93 |
Correct |
222 ms |
20220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
12636 KB |
Output is correct |
2 |
Correct |
4 ms |
12724 KB |
Output is correct |
3 |
Correct |
4 ms |
12756 KB |
Output is correct |
4 |
Correct |
4 ms |
12752 KB |
Output is correct |
5 |
Correct |
3 ms |
12888 KB |
Output is correct |
6 |
Correct |
4 ms |
12636 KB |
Output is correct |
7 |
Correct |
4 ms |
12736 KB |
Output is correct |
8 |
Correct |
3 ms |
12636 KB |
Output is correct |
9 |
Correct |
3 ms |
12636 KB |
Output is correct |
10 |
Correct |
3 ms |
12636 KB |
Output is correct |
11 |
Correct |
4 ms |
12636 KB |
Output is correct |
12 |
Correct |
4 ms |
12724 KB |
Output is correct |
13 |
Correct |
4 ms |
12724 KB |
Output is correct |
14 |
Correct |
3 ms |
12840 KB |
Output is correct |
15 |
Correct |
4 ms |
12636 KB |
Output is correct |
16 |
Correct |
3 ms |
12772 KB |
Output is correct |
17 |
Correct |
2 ms |
12636 KB |
Output is correct |
18 |
Correct |
1 ms |
12728 KB |
Output is correct |
19 |
Correct |
3 ms |
12636 KB |
Output is correct |
20 |
Correct |
3 ms |
12752 KB |
Output is correct |
21 |
Correct |
4 ms |
12636 KB |
Output is correct |
22 |
Correct |
2 ms |
12636 KB |
Output is correct |
23 |
Correct |
2 ms |
12636 KB |
Output is correct |
24 |
Correct |
2 ms |
12636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
12636 KB |
Output is correct |
2 |
Correct |
1 ms |
12636 KB |
Output is correct |
3 |
Correct |
2 ms |
12636 KB |
Output is correct |
4 |
Correct |
2 ms |
12636 KB |
Output is correct |
5 |
Correct |
1 ms |
12716 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12636 KB |
Output is correct |
8 |
Correct |
1 ms |
12712 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
314 ms |
20764 KB |
Output is correct |
11 |
Correct |
303 ms |
20400 KB |
Output is correct |
12 |
Correct |
312 ms |
20504 KB |
Output is correct |
13 |
Correct |
300 ms |
20216 KB |
Output is correct |
14 |
Correct |
259 ms |
20380 KB |
Output is correct |
15 |
Correct |
265 ms |
20388 KB |
Output is correct |
16 |
Correct |
2 ms |
12636 KB |
Output is correct |
17 |
Correct |
2 ms |
12636 KB |
Output is correct |
18 |
Correct |
7 ms |
12828 KB |
Output is correct |
19 |
Correct |
7 ms |
12636 KB |
Output is correct |
20 |
Correct |
2 ms |
12724 KB |
Output is correct |
21 |
Correct |
3 ms |
12636 KB |
Output is correct |
22 |
Correct |
295 ms |
20384 KB |
Output is correct |
23 |
Correct |
188 ms |
20256 KB |
Output is correct |
24 |
Correct |
209 ms |
20308 KB |
Output is correct |
25 |
Correct |
172 ms |
20248 KB |
Output is correct |
26 |
Correct |
243 ms |
20208 KB |
Output is correct |
27 |
Correct |
236 ms |
20308 KB |
Output is correct |
28 |
Correct |
1 ms |
12636 KB |
Output is correct |
29 |
Correct |
2 ms |
12636 KB |
Output is correct |
30 |
Correct |
2 ms |
12636 KB |
Output is correct |
31 |
Correct |
2 ms |
12716 KB |
Output is correct |
32 |
Correct |
233 ms |
20132 KB |
Output is correct |
33 |
Correct |
270 ms |
20384 KB |
Output is correct |
34 |
Correct |
143 ms |
19644 KB |
Output is correct |
35 |
Correct |
163 ms |
19540 KB |
Output is correct |
36 |
Correct |
131 ms |
19552 KB |
Output is correct |
37 |
Correct |
60 ms |
19192 KB |
Output is correct |
38 |
Correct |
59 ms |
18952 KB |
Output is correct |
39 |
Correct |
203 ms |
22952 KB |
Output is correct |
40 |
Correct |
191 ms |
20516 KB |
Output is correct |
41 |
Correct |
240 ms |
24876 KB |
Output is correct |
42 |
Correct |
121 ms |
19636 KB |
Output is correct |
43 |
Correct |
242 ms |
25080 KB |
Output is correct |
44 |
Correct |
280 ms |
25260 KB |
Output is correct |
45 |
Correct |
1 ms |
12636 KB |
Output is correct |
46 |
Correct |
1 ms |
12636 KB |
Output is correct |
47 |
Correct |
2 ms |
12636 KB |
Output is correct |
48 |
Correct |
2 ms |
12636 KB |
Output is correct |
49 |
Correct |
27 ms |
15124 KB |
Output is correct |
50 |
Correct |
203 ms |
19956 KB |
Output is correct |
51 |
Correct |
219 ms |
20036 KB |
Output is correct |
52 |
Correct |
246 ms |
20148 KB |
Output is correct |
53 |
Correct |
213 ms |
20252 KB |
Output is correct |
54 |
Correct |
124 ms |
19484 KB |
Output is correct |
55 |
Correct |
172 ms |
19796 KB |
Output is correct |
56 |
Correct |
200 ms |
20056 KB |
Output is correct |
57 |
Correct |
216 ms |
20052 KB |
Output is correct |
58 |
Correct |
225 ms |
20332 KB |
Output is correct |
59 |
Correct |
210 ms |
20008 KB |
Output is correct |
60 |
Correct |
203 ms |
20136 KB |
Output is correct |
61 |
Correct |
226 ms |
20344 KB |
Output is correct |
62 |
Correct |
209 ms |
20344 KB |
Output is correct |
63 |
Correct |
218 ms |
20300 KB |
Output is correct |
64 |
Correct |
162 ms |
20340 KB |
Output is correct |
65 |
Correct |
230 ms |
20348 KB |
Output is correct |
66 |
Correct |
186 ms |
20340 KB |
Output is correct |
67 |
Correct |
2 ms |
12636 KB |
Output is correct |
68 |
Correct |
1 ms |
12724 KB |
Output is correct |
69 |
Correct |
2 ms |
12636 KB |
Output is correct |
70 |
Correct |
1 ms |
12636 KB |
Output is correct |
71 |
Correct |
2 ms |
12636 KB |
Output is correct |
72 |
Correct |
148 ms |
19548 KB |
Output is correct |
73 |
Correct |
181 ms |
19796 KB |
Output is correct |
74 |
Correct |
115 ms |
19284 KB |
Output is correct |
75 |
Correct |
112 ms |
19284 KB |
Output is correct |
76 |
Correct |
107 ms |
19540 KB |
Output is correct |
77 |
Correct |
127 ms |
19280 KB |
Output is correct |
78 |
Correct |
310 ms |
21540 KB |
Output is correct |
79 |
Correct |
314 ms |
21588 KB |
Output is correct |
80 |
Correct |
291 ms |
21452 KB |
Output is correct |
81 |
Correct |
316 ms |
21696 KB |
Output is correct |
82 |
Correct |
270 ms |
21452 KB |
Output is correct |
83 |
Correct |
186 ms |
21572 KB |
Output is correct |
84 |
Correct |
225 ms |
21444 KB |
Output is correct |
85 |
Correct |
178 ms |
21332 KB |
Output is correct |
86 |
Correct |
233 ms |
21448 KB |
Output is correct |
87 |
Correct |
241 ms |
21332 KB |
Output is correct |
88 |
Correct |
4 ms |
12780 KB |
Output is correct |
89 |
Correct |
5 ms |
12636 KB |
Output is correct |
90 |
Correct |
286 ms |
19840 KB |
Output is correct |
91 |
Correct |
266 ms |
19676 KB |
Output is correct |
92 |
Correct |
244 ms |
19460 KB |
Output is correct |
93 |
Correct |
242 ms |
19468 KB |
Output is correct |
94 |
Correct |
13 ms |
12892 KB |
Output is correct |
95 |
Correct |
28 ms |
15232 KB |
Output is correct |
96 |
Correct |
239 ms |
19300 KB |
Output is correct |
97 |
Correct |
221 ms |
19288 KB |
Output is correct |
98 |
Correct |
289 ms |
19540 KB |
Output is correct |
99 |
Correct |
281 ms |
19520 KB |
Output is correct |
100 |
Correct |
295 ms |
19540 KB |
Output is correct |
101 |
Correct |
312 ms |
19628 KB |
Output is correct |
102 |
Correct |
304 ms |
19624 KB |
Output is correct |
103 |
Correct |
299 ms |
19744 KB |
Output is correct |
104 |
Correct |
259 ms |
19792 KB |
Output is correct |
105 |
Correct |
209 ms |
19856 KB |
Output is correct |
106 |
Correct |
268 ms |
19876 KB |
Output is correct |
107 |
Correct |
176 ms |
19804 KB |
Output is correct |
108 |
Correct |
279 ms |
19796 KB |
Output is correct |
109 |
Correct |
232 ms |
19780 KB |
Output is correct |
110 |
Correct |
2 ms |
12636 KB |
Output is correct |
111 |
Correct |
231 ms |
19488 KB |
Output is correct |
112 |
Correct |
266 ms |
19412 KB |
Output is correct |
113 |
Correct |
328 ms |
19796 KB |
Output is correct |
114 |
Correct |
49 ms |
14952 KB |
Output is correct |
115 |
Correct |
63 ms |
15188 KB |
Output is correct |
116 |
Correct |
68 ms |
15420 KB |
Output is correct |
117 |
Correct |
281 ms |
20864 KB |
Output is correct |
118 |
Correct |
238 ms |
20400 KB |
Output is correct |
119 |
Correct |
225 ms |
20128 KB |
Output is correct |
120 |
Correct |
270 ms |
20428 KB |
Output is correct |
121 |
Correct |
249 ms |
20308 KB |
Output is correct |
122 |
Correct |
277 ms |
20728 KB |
Output is correct |
123 |
Correct |
192 ms |
20640 KB |
Output is correct |
124 |
Correct |
235 ms |
20516 KB |
Output is correct |
125 |
Correct |
184 ms |
20712 KB |
Output is correct |
126 |
Correct |
280 ms |
21004 KB |
Output is correct |
127 |
Correct |
233 ms |
20264 KB |
Output is correct |
128 |
Correct |
305 ms |
20760 KB |
Output is correct |
129 |
Correct |
265 ms |
20492 KB |
Output is correct |
130 |
Correct |
257 ms |
20384 KB |
Output is correct |
131 |
Correct |
246 ms |
20288 KB |
Output is correct |
132 |
Correct |
11 ms |
13144 KB |
Output is correct |
133 |
Correct |
28 ms |
15320 KB |
Output is correct |
134 |
Correct |
237 ms |
20364 KB |
Output is correct |
135 |
Correct |
256 ms |
20188 KB |
Output is correct |
136 |
Correct |
283 ms |
20620 KB |
Output is correct |
137 |
Correct |
289 ms |
20308 KB |
Output is correct |
138 |
Correct |
295 ms |
20564 KB |
Output is correct |
139 |
Correct |
307 ms |
20564 KB |
Output is correct |
140 |
Correct |
297 ms |
20552 KB |
Output is correct |
141 |
Correct |
305 ms |
20548 KB |
Output is correct |
142 |
Correct |
270 ms |
20564 KB |
Output is correct |
143 |
Correct |
180 ms |
20568 KB |
Output is correct |
144 |
Correct |
245 ms |
20752 KB |
Output is correct |
145 |
Correct |
176 ms |
20632 KB |
Output is correct |
146 |
Correct |
286 ms |
20900 KB |
Output is correct |
147 |
Correct |
222 ms |
20220 KB |
Output is correct |
148 |
Correct |
4 ms |
12636 KB |
Output is correct |
149 |
Correct |
4 ms |
12724 KB |
Output is correct |
150 |
Correct |
4 ms |
12756 KB |
Output is correct |
151 |
Correct |
4 ms |
12752 KB |
Output is correct |
152 |
Correct |
3 ms |
12888 KB |
Output is correct |
153 |
Correct |
4 ms |
12636 KB |
Output is correct |
154 |
Correct |
4 ms |
12736 KB |
Output is correct |
155 |
Correct |
3 ms |
12636 KB |
Output is correct |
156 |
Correct |
3 ms |
12636 KB |
Output is correct |
157 |
Correct |
3 ms |
12636 KB |
Output is correct |
158 |
Correct |
4 ms |
12636 KB |
Output is correct |
159 |
Correct |
4 ms |
12724 KB |
Output is correct |
160 |
Correct |
4 ms |
12724 KB |
Output is correct |
161 |
Correct |
3 ms |
12840 KB |
Output is correct |
162 |
Correct |
4 ms |
12636 KB |
Output is correct |
163 |
Correct |
3 ms |
12772 KB |
Output is correct |
164 |
Correct |
2 ms |
12636 KB |
Output is correct |
165 |
Correct |
1 ms |
12728 KB |
Output is correct |
166 |
Correct |
3 ms |
12636 KB |
Output is correct |
167 |
Correct |
3 ms |
12752 KB |
Output is correct |
168 |
Correct |
4 ms |
12636 KB |
Output is correct |
169 |
Correct |
2 ms |
12636 KB |
Output is correct |
170 |
Correct |
2 ms |
12636 KB |
Output is correct |
171 |
Correct |
2 ms |
12636 KB |
Output is correct |
172 |
Correct |
260 ms |
21592 KB |
Output is correct |
173 |
Correct |
236 ms |
21216 KB |
Output is correct |
174 |
Correct |
225 ms |
20820 KB |
Output is correct |
175 |
Correct |
236 ms |
20968 KB |
Output is correct |
176 |
Correct |
256 ms |
20820 KB |
Output is correct |
177 |
Correct |
256 ms |
21056 KB |
Output is correct |
178 |
Correct |
250 ms |
21548 KB |
Output is correct |
179 |
Correct |
194 ms |
21332 KB |
Output is correct |
180 |
Correct |
263 ms |
21588 KB |
Output is correct |
181 |
Correct |
173 ms |
21332 KB |
Output is correct |
182 |
Correct |
281 ms |
21348 KB |
Output is correct |
183 |
Correct |
256 ms |
21384 KB |
Output is correct |