#include <stdio.h>
#include <stdlib.h>
#define N 200000
#define M 200000
#define L 19 /* L = ceil(log2(M * 2)) */
#define M_ (1 << L)
#define N_ (M_ * (L + 1) + 1)
#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; }
unsigned int X = 12345;
int rand_() {
return (X *= 3) >> 1;
}
int *ej[N], eo[N], *eh[N], eo_[N];
void append(int **ej, int *eo, 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 dd[N], pp[N], qq[N], ta[N], tb[N];
int dfs1(int i, int d) {
int o, s, k_, j_;
dd[i] = d;
s = 1, k_ = 0, j_ = -1;
for (o = eo[i]; o--; ) {
int j = ej[i][o], k = dfs1(j, d + 1);
s += k;
if (k_ < k)
k_ = k, j_ = j;
}
qq[i] = j_;
return s;
}
void dfs2(int i, int q) {
static int time;
int o, j_;
ta[i] = time++;
j_ = qq[i], qq[i] = q;
if (j_ != -1)
dfs2(j_, q);
for (o = eo[i]; o--; ) {
int j = ej[i][o];
if (j != j_)
dfs2(j, j);
}
tb[i] = time;
}
int lca(int i, int j) {
while (qq[i] != qq[j])
if (dd[qq[i]] > dd[qq[j]])
i = pp[qq[i]];
else
j = pp[qq[j]];
return dd[i] < dd[j] ? i : j;
}
int ii[M * 2], idx[M * 2];
void sort(int *hh, int l, int r) {
while (l < r) {
int i = l, j = l, k = r, h = hh[l + rand_() % (r - l)], tmp;
while (j < k) {
int c = ta[ii[hh[j]]] - ta[ii[h]];
if (c == 0)
j++;
else if (c < 0) {
tmp = hh[i], hh[i] = hh[j], hh[j] = tmp;
i++, j++;
} else {
k--;
tmp = hh[j], hh[j] = hh[k], hh[k] = tmp;
}
}
sort(hh, l, i);
l = k;
}
}
int hh_[M_], dd1[M_ * 2], ddmn[M_ * 2], m_;
void build(int l, int r) {
int m;
if (r - l == 1)
ddmn[l + r] = INF;
else {
m = (l + r) / 2;
build(l, m), build(m, r);
ddmn[l + r] = min(min(ddmn[l + m], dd1[m]), ddmn[m + r]);
}
}
int ll[N_], rr[N_], ddp[N_], ddq[N_], ddmx[N_];
int node(int l, int r, int i) {
static int _ = 1;
int t = _++;
if (r - l == 1)
ddp[t] = ddq[t] = INF, ddmx[t] = -1;
else {
int m = (l + r) / 2;
if (i < m) {
ll[t] = node(l, m, i);
ddp[t] = ddp[ll[t]], ddq[t] = min(min(ddq[ll[t]], dd1[m]), ddmn[m + r]);
} else {
rr[t] = node(m, r, i);
ddp[t] = min(min(ddmn[l + m], dd1[m]), ddp[rr[t]]), ddq[t] = ddq[rr[t]];
}
ddmx[t] = -1;
}
return t;
}
int remove_(int t, int l, int r, int i) {
int m;
if (r - l == 1)
t = 0;
else {
m = (l + r) / 2;
if (i < m)
ll[t] = remove_(ll[t], l, m, i);
else
rr[t] = remove_(rr[t], m, r, i);
if (ll[t] == 0 && rr[t] == 0)
t = 0;
else {
ddp[t] = ll[t] ? ddp[ll[t]] : min(min(ddmn[l + m], dd1[m]), ddp[rr[t]]);
ddq[t] = rr[t] ? ddq[rr[t]] : min(min(ddq[ll[t]], dd1[m]), ddmn[m + r]);
ddmx[t] = max(max(ddmx[ll[t]], ddmx[rr[t]]), min(min(ddq[ll[t]], dd1[m]), ddp[rr[t]]));
}
}
return t;
}
int merge(int t1, int t2, int l, int r) {
int m;
if (t1 == 0)
return t2;
if (t2 == 0)
return t1;
m = (l + r) / 2;
ll[t1] = merge(ll[t1], ll[t2], l, m), rr[t1] = merge(rr[t1], rr[t2], m, r);
ddp[t1] = ll[t1] ? ddp[ll[t1]] : min(min(ddmn[l + m], dd1[m]), ddp[rr[t1]]);
ddq[t1] = rr[t1] ? ddq[rr[t1]] : min(min(ddq[ll[t1]], dd1[m]), ddmn[m + r]);
ddmx[t1] = max(max(ddmx[ll[t1]], ddmx[rr[t1]]), min(min(ddq[ll[t1]], dd1[m]), ddp[rr[t1]]));
return t1;
}
int find_p(int t, int l, int r) {
int m;
if (r - l == 1)
return hh_[l] >> 1;
m = (l + r) / 2;
return ll[t] ? find_p(ll[t], l, m) : find_p(rr[t], m, r);
}
int find_q(int t, int l, int r) {
int m;
if (r - l == 1)
return hh_[l] >> 1;
m = (l + r) / 2;
return rr[t] ? find_q(rr[t], m, r) : find_q(ll[t], l, m);
}
void find_mx(int t, int l, int r, int *h1, int *h2) {
int m;
m = (l + r) / 2;
if (ddmx[ll[t]] == ddmx[t])
find_mx(ll[t], l, m, h1, h2);
else if (ddmx[rr[t]] == ddmx[t])
find_mx(rr[t], m, r, h1, h2);
else
*h1 = find_q(ll[t], l, m), *h2 = find_p(rr[t], m, r);
}
int t_, d_, h1_, h2_;
void dfs3(int i) {
static int hh[M * 2], tt[M * 2], dd1[M * 2];
int m, cnt, h, o, d, d1;
if (eo_[i]) {
m = 0;
for (o = eo_[i]; o--; ) {
h = eh[i][o];
hh[m++] = h << 1 | 0, hh[m++] = h << 1 | 1;
}
sort(hh, 0, m);
cnt = 0;
for (h = 0; h <= m; h++) {
d1 = h == 0 || h == m ? -1 : dd[lca(ii[hh[h]], ii[hh[h - 1]])];
while (cnt >= 2 && dd1[cnt - 1] >= d1) {
tt[cnt - 2] = merge(tt[cnt - 2], tt[cnt - 1], 0, m_);
if (ddmx[tt[cnt - 2]] != -1) {
d = dd1[cnt - 1] + ddmx[tt[cnt - 2]] - dd[i] * 2;
if (d_ < d)
d_ = d, find_mx(tt[cnt - 2], 0, m_, &h1_, &h2_);
}
cnt--;
}
if (h < m)
tt[cnt] = node(0, m_, idx[hh[h] ^ 1]), dd1[cnt] = d1, cnt++;
}
t_ = merge(t_, tt[0], 0, m_);
}
if (ddmx[t_] != -1) {
d = ddmx[t_] - dd[i];
if (d_ < d)
d_ = d, find_mx(t_, 0, m_, &h1_, &h2_);
}
for (o = eo[i]; o--; ) {
int j = ej[i][o];
dfs3(j);
}
for (o = eo_[i]; o--; ) {
h = eh[i][o];
t_ = remove_(t_, 0, m_, idx[h << 1 | 0]);
t_ = remove_(t_, 0, m_, idx[h << 1 | 1]);
}
}
int main() {
int n, m, h, i, j;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++)
ej[i] = (int *) malloc(2 * sizeof *ej[i]);
for (i = 1; i < n; i++) {
scanf("%d", &pp[i]), pp[i]--;
append(ej, eo, pp[i], i);
}
dfs1(0, 0);
dfs2(0, 0);
for (i = 0; i < n; i++)
eh[i] = (int *) malloc(2 * sizeof *eh[i]);
for (h = 0; h < m; h++) {
scanf("%d%d", &i, &j), i--, j--;
ii[h << 1 | 0] = i, ii[h << 1 | 1] = j;
append(eh, eo_, lca(i, j), h);
}
for (h = 0; h < m * 2; h++)
hh_[h] = h;
sort(hh_, 0, m * 2);
for (h = 0; h < m * 2; h++)
idx[hh_[h]] = h;
for (h = 1; h < m * 2; h++)
dd1[h] = dd[lca(ii[hh_[h - 1]], ii[hh_[h]])];
m_ = 1;
while (m_ < m * 2)
m_ <<= 1;
build(0, m_);
ddp[0] = -1, ddq[0] = -1, ddmx[0] = -1;
d_ = 0, h1_ = 0, h2_ = 1, dfs3(0);
printf("%d\n", d_);
printf("%d %d\n", h1_ + 1, h2_ + 1);
return 0;
}
Compilation message
sending.c: In function 'append':
sending.c:25:23: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
25 | if (o >= 2 && (o & o - 1) == 0)
| ~~^~~
sending.c: In function 'main':
sending.c:252:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
252 | scanf("%d%d", &n, &m);
| ^~~~~~~~~~~~~~~~~~~~~
sending.c:256:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
256 | scanf("%d", &pp[i]), pp[i]--;
| ^~~~~~~~~~~~~~~~~~~
sending.c:264:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
264 | scanf("%d%d", &i, &j), i--, j--;
| ^~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
20 |
Correct |
6 ms |
31324 KB |
Output is correct |
21 |
Correct |
5 ms |
31324 KB |
Output is correct |
22 |
Correct |
5 ms |
31836 KB |
Output is correct |
23 |
Correct |
5 ms |
31580 KB |
Output is correct |
24 |
Correct |
5 ms |
31580 KB |
Output is correct |
25 |
Correct |
5 ms |
31456 KB |
Output is correct |
26 |
Correct |
5 ms |
31836 KB |
Output is correct |
27 |
Correct |
5 ms |
31580 KB |
Output is correct |
28 |
Correct |
6 ms |
31324 KB |
Output is correct |
29 |
Correct |
5 ms |
31836 KB |
Output is correct |
30 |
Correct |
5 ms |
31836 KB |
Output is correct |
31 |
Correct |
5 ms |
31836 KB |
Output is correct |
32 |
Correct |
5 ms |
31728 KB |
Output is correct |
33 |
Correct |
5 ms |
31540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
20 |
Correct |
6 ms |
31324 KB |
Output is correct |
21 |
Correct |
5 ms |
31324 KB |
Output is correct |
22 |
Correct |
5 ms |
31836 KB |
Output is correct |
23 |
Correct |
5 ms |
31580 KB |
Output is correct |
24 |
Correct |
5 ms |
31580 KB |
Output is correct |
25 |
Correct |
5 ms |
31456 KB |
Output is correct |
26 |
Correct |
5 ms |
31836 KB |
Output is correct |
27 |
Correct |
5 ms |
31580 KB |
Output is correct |
28 |
Correct |
6 ms |
31324 KB |
Output is correct |
29 |
Correct |
5 ms |
31836 KB |
Output is correct |
30 |
Correct |
5 ms |
31836 KB |
Output is correct |
31 |
Correct |
5 ms |
31836 KB |
Output is correct |
32 |
Correct |
5 ms |
31728 KB |
Output is correct |
33 |
Correct |
5 ms |
31540 KB |
Output is correct |
34 |
Correct |
28 ms |
37468 KB |
Output is correct |
35 |
Correct |
33 ms |
37464 KB |
Output is correct |
36 |
Correct |
25 ms |
46940 KB |
Output is correct |
37 |
Correct |
23 ms |
42076 KB |
Output is correct |
38 |
Correct |
25 ms |
42064 KB |
Output is correct |
39 |
Correct |
17 ms |
37720 KB |
Output is correct |
40 |
Correct |
27 ms |
46936 KB |
Output is correct |
41 |
Correct |
17 ms |
37976 KB |
Output is correct |
42 |
Correct |
18 ms |
37468 KB |
Output is correct |
43 |
Correct |
23 ms |
45904 KB |
Output is correct |
44 |
Correct |
26 ms |
45820 KB |
Output is correct |
45 |
Correct |
23 ms |
45808 KB |
Output is correct |
46 |
Correct |
25 ms |
45904 KB |
Output is correct |
47 |
Correct |
21 ms |
38628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
20 |
Correct |
6 ms |
31324 KB |
Output is correct |
21 |
Correct |
5 ms |
31324 KB |
Output is correct |
22 |
Correct |
5 ms |
31836 KB |
Output is correct |
23 |
Correct |
5 ms |
31580 KB |
Output is correct |
24 |
Correct |
5 ms |
31580 KB |
Output is correct |
25 |
Correct |
5 ms |
31456 KB |
Output is correct |
26 |
Correct |
5 ms |
31836 KB |
Output is correct |
27 |
Correct |
5 ms |
31580 KB |
Output is correct |
28 |
Correct |
6 ms |
31324 KB |
Output is correct |
29 |
Correct |
5 ms |
31836 KB |
Output is correct |
30 |
Correct |
5 ms |
31836 KB |
Output is correct |
31 |
Correct |
5 ms |
31836 KB |
Output is correct |
32 |
Correct |
5 ms |
31728 KB |
Output is correct |
33 |
Correct |
5 ms |
31540 KB |
Output is correct |
34 |
Correct |
28 ms |
37468 KB |
Output is correct |
35 |
Correct |
33 ms |
37464 KB |
Output is correct |
36 |
Correct |
25 ms |
46940 KB |
Output is correct |
37 |
Correct |
23 ms |
42076 KB |
Output is correct |
38 |
Correct |
25 ms |
42064 KB |
Output is correct |
39 |
Correct |
17 ms |
37720 KB |
Output is correct |
40 |
Correct |
27 ms |
46936 KB |
Output is correct |
41 |
Correct |
17 ms |
37976 KB |
Output is correct |
42 |
Correct |
18 ms |
37468 KB |
Output is correct |
43 |
Correct |
23 ms |
45904 KB |
Output is correct |
44 |
Correct |
26 ms |
45820 KB |
Output is correct |
45 |
Correct |
23 ms |
45808 KB |
Output is correct |
46 |
Correct |
25 ms |
45904 KB |
Output is correct |
47 |
Correct |
21 ms |
38628 KB |
Output is correct |
48 |
Correct |
38 ms |
37980 KB |
Output is correct |
49 |
Correct |
40 ms |
37992 KB |
Output is correct |
50 |
Correct |
35 ms |
47196 KB |
Output is correct |
51 |
Correct |
30 ms |
42588 KB |
Output is correct |
52 |
Correct |
30 ms |
42588 KB |
Output is correct |
53 |
Correct |
23 ms |
38232 KB |
Output is correct |
54 |
Correct |
36 ms |
47188 KB |
Output is correct |
55 |
Correct |
24 ms |
38492 KB |
Output is correct |
56 |
Correct |
26 ms |
37968 KB |
Output is correct |
57 |
Correct |
29 ms |
46928 KB |
Output is correct |
58 |
Correct |
28 ms |
46684 KB |
Output is correct |
59 |
Correct |
26 ms |
46676 KB |
Output is correct |
60 |
Correct |
34 ms |
46936 KB |
Output is correct |
61 |
Correct |
33 ms |
46164 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
127 ms |
69500 KB |
Output is correct |
2 |
Correct |
199 ms |
70156 KB |
Output is correct |
3 |
Correct |
182 ms |
69712 KB |
Output is correct |
4 |
Correct |
170 ms |
69792 KB |
Output is correct |
5 |
Correct |
126 ms |
69588 KB |
Output is correct |
6 |
Correct |
175 ms |
69460 KB |
Output is correct |
7 |
Correct |
188 ms |
69708 KB |
Output is correct |
8 |
Correct |
185 ms |
69608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
129 ms |
69460 KB |
Output is correct |
2 |
Correct |
136 ms |
69592 KB |
Output is correct |
3 |
Correct |
138 ms |
78672 KB |
Output is correct |
4 |
Correct |
128 ms |
74064 KB |
Output is correct |
5 |
Correct |
140 ms |
74116 KB |
Output is correct |
6 |
Correct |
147 ms |
69940 KB |
Output is correct |
7 |
Correct |
140 ms |
78676 KB |
Output is correct |
8 |
Correct |
119 ms |
70228 KB |
Output is correct |
9 |
Correct |
110 ms |
69460 KB |
Output is correct |
10 |
Correct |
99 ms |
78996 KB |
Output is correct |
11 |
Correct |
62 ms |
68292 KB |
Output is correct |
12 |
Correct |
57 ms |
68292 KB |
Output is correct |
13 |
Correct |
149 ms |
78908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
20 |
Correct |
6 ms |
31324 KB |
Output is correct |
21 |
Correct |
5 ms |
31324 KB |
Output is correct |
22 |
Correct |
5 ms |
31836 KB |
Output is correct |
23 |
Correct |
5 ms |
31580 KB |
Output is correct |
24 |
Correct |
5 ms |
31580 KB |
Output is correct |
25 |
Correct |
5 ms |
31456 KB |
Output is correct |
26 |
Correct |
5 ms |
31836 KB |
Output is correct |
27 |
Correct |
5 ms |
31580 KB |
Output is correct |
28 |
Correct |
6 ms |
31324 KB |
Output is correct |
29 |
Correct |
5 ms |
31836 KB |
Output is correct |
30 |
Correct |
5 ms |
31836 KB |
Output is correct |
31 |
Correct |
5 ms |
31836 KB |
Output is correct |
32 |
Correct |
5 ms |
31728 KB |
Output is correct |
33 |
Correct |
5 ms |
31540 KB |
Output is correct |
34 |
Correct |
28 ms |
37468 KB |
Output is correct |
35 |
Correct |
33 ms |
37464 KB |
Output is correct |
36 |
Correct |
25 ms |
46940 KB |
Output is correct |
37 |
Correct |
23 ms |
42076 KB |
Output is correct |
38 |
Correct |
25 ms |
42064 KB |
Output is correct |
39 |
Correct |
17 ms |
37720 KB |
Output is correct |
40 |
Correct |
27 ms |
46936 KB |
Output is correct |
41 |
Correct |
17 ms |
37976 KB |
Output is correct |
42 |
Correct |
18 ms |
37468 KB |
Output is correct |
43 |
Correct |
23 ms |
45904 KB |
Output is correct |
44 |
Correct |
26 ms |
45820 KB |
Output is correct |
45 |
Correct |
23 ms |
45808 KB |
Output is correct |
46 |
Correct |
25 ms |
45904 KB |
Output is correct |
47 |
Correct |
21 ms |
38628 KB |
Output is correct |
48 |
Correct |
38 ms |
37980 KB |
Output is correct |
49 |
Correct |
40 ms |
37992 KB |
Output is correct |
50 |
Correct |
35 ms |
47196 KB |
Output is correct |
51 |
Correct |
30 ms |
42588 KB |
Output is correct |
52 |
Correct |
30 ms |
42588 KB |
Output is correct |
53 |
Correct |
23 ms |
38232 KB |
Output is correct |
54 |
Correct |
36 ms |
47188 KB |
Output is correct |
55 |
Correct |
24 ms |
38492 KB |
Output is correct |
56 |
Correct |
26 ms |
37968 KB |
Output is correct |
57 |
Correct |
29 ms |
46928 KB |
Output is correct |
58 |
Correct |
28 ms |
46684 KB |
Output is correct |
59 |
Correct |
26 ms |
46676 KB |
Output is correct |
60 |
Correct |
34 ms |
46936 KB |
Output is correct |
61 |
Correct |
33 ms |
46164 KB |
Output is correct |
62 |
Correct |
127 ms |
69500 KB |
Output is correct |
63 |
Correct |
199 ms |
70156 KB |
Output is correct |
64 |
Correct |
182 ms |
69712 KB |
Output is correct |
65 |
Correct |
170 ms |
69792 KB |
Output is correct |
66 |
Correct |
126 ms |
69588 KB |
Output is correct |
67 |
Correct |
175 ms |
69460 KB |
Output is correct |
68 |
Correct |
188 ms |
69708 KB |
Output is correct |
69 |
Correct |
185 ms |
69608 KB |
Output is correct |
70 |
Correct |
129 ms |
69460 KB |
Output is correct |
71 |
Correct |
136 ms |
69592 KB |
Output is correct |
72 |
Correct |
138 ms |
78672 KB |
Output is correct |
73 |
Correct |
128 ms |
74064 KB |
Output is correct |
74 |
Correct |
140 ms |
74116 KB |
Output is correct |
75 |
Correct |
147 ms |
69940 KB |
Output is correct |
76 |
Correct |
140 ms |
78676 KB |
Output is correct |
77 |
Correct |
119 ms |
70228 KB |
Output is correct |
78 |
Correct |
110 ms |
69460 KB |
Output is correct |
79 |
Correct |
99 ms |
78996 KB |
Output is correct |
80 |
Correct |
62 ms |
68292 KB |
Output is correct |
81 |
Correct |
57 ms |
68292 KB |
Output is correct |
82 |
Correct |
149 ms |
78908 KB |
Output is correct |
83 |
Correct |
179 ms |
70740 KB |
Output is correct |
84 |
Correct |
176 ms |
70868 KB |
Output is correct |
85 |
Correct |
154 ms |
79924 KB |
Output is correct |
86 |
Correct |
152 ms |
75348 KB |
Output is correct |
87 |
Correct |
145 ms |
75092 KB |
Output is correct |
88 |
Correct |
173 ms |
70996 KB |
Output is correct |
89 |
Correct |
139 ms |
79676 KB |
Output is correct |
90 |
Correct |
147 ms |
71260 KB |
Output is correct |
91 |
Correct |
165 ms |
70804 KB |
Output is correct |
92 |
Correct |
143 ms |
79084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
31068 KB |
Output is correct |
2 |
Correct |
3 ms |
31068 KB |
Output is correct |
3 |
Correct |
3 ms |
31068 KB |
Output is correct |
4 |
Correct |
3 ms |
31068 KB |
Output is correct |
5 |
Correct |
3 ms |
31068 KB |
Output is correct |
6 |
Correct |
3 ms |
31068 KB |
Output is correct |
7 |
Correct |
3 ms |
31068 KB |
Output is correct |
8 |
Correct |
3 ms |
31068 KB |
Output is correct |
9 |
Correct |
3 ms |
31064 KB |
Output is correct |
10 |
Correct |
3 ms |
31064 KB |
Output is correct |
11 |
Correct |
3 ms |
31068 KB |
Output is correct |
12 |
Correct |
3 ms |
31064 KB |
Output is correct |
13 |
Correct |
3 ms |
31064 KB |
Output is correct |
14 |
Correct |
3 ms |
31068 KB |
Output is correct |
15 |
Correct |
3 ms |
31068 KB |
Output is correct |
16 |
Correct |
3 ms |
31068 KB |
Output is correct |
17 |
Correct |
3 ms |
31068 KB |
Output is correct |
18 |
Correct |
3 ms |
31068 KB |
Output is correct |
19 |
Correct |
3 ms |
31068 KB |
Output is correct |
20 |
Correct |
6 ms |
31324 KB |
Output is correct |
21 |
Correct |
5 ms |
31324 KB |
Output is correct |
22 |
Correct |
5 ms |
31836 KB |
Output is correct |
23 |
Correct |
5 ms |
31580 KB |
Output is correct |
24 |
Correct |
5 ms |
31580 KB |
Output is correct |
25 |
Correct |
5 ms |
31456 KB |
Output is correct |
26 |
Correct |
5 ms |
31836 KB |
Output is correct |
27 |
Correct |
5 ms |
31580 KB |
Output is correct |
28 |
Correct |
6 ms |
31324 KB |
Output is correct |
29 |
Correct |
5 ms |
31836 KB |
Output is correct |
30 |
Correct |
5 ms |
31836 KB |
Output is correct |
31 |
Correct |
5 ms |
31836 KB |
Output is correct |
32 |
Correct |
5 ms |
31728 KB |
Output is correct |
33 |
Correct |
5 ms |
31540 KB |
Output is correct |
34 |
Correct |
28 ms |
37468 KB |
Output is correct |
35 |
Correct |
33 ms |
37464 KB |
Output is correct |
36 |
Correct |
25 ms |
46940 KB |
Output is correct |
37 |
Correct |
23 ms |
42076 KB |
Output is correct |
38 |
Correct |
25 ms |
42064 KB |
Output is correct |
39 |
Correct |
17 ms |
37720 KB |
Output is correct |
40 |
Correct |
27 ms |
46936 KB |
Output is correct |
41 |
Correct |
17 ms |
37976 KB |
Output is correct |
42 |
Correct |
18 ms |
37468 KB |
Output is correct |
43 |
Correct |
23 ms |
45904 KB |
Output is correct |
44 |
Correct |
26 ms |
45820 KB |
Output is correct |
45 |
Correct |
23 ms |
45808 KB |
Output is correct |
46 |
Correct |
25 ms |
45904 KB |
Output is correct |
47 |
Correct |
21 ms |
38628 KB |
Output is correct |
48 |
Correct |
38 ms |
37980 KB |
Output is correct |
49 |
Correct |
40 ms |
37992 KB |
Output is correct |
50 |
Correct |
35 ms |
47196 KB |
Output is correct |
51 |
Correct |
30 ms |
42588 KB |
Output is correct |
52 |
Correct |
30 ms |
42588 KB |
Output is correct |
53 |
Correct |
23 ms |
38232 KB |
Output is correct |
54 |
Correct |
36 ms |
47188 KB |
Output is correct |
55 |
Correct |
24 ms |
38492 KB |
Output is correct |
56 |
Correct |
26 ms |
37968 KB |
Output is correct |
57 |
Correct |
29 ms |
46928 KB |
Output is correct |
58 |
Correct |
28 ms |
46684 KB |
Output is correct |
59 |
Correct |
26 ms |
46676 KB |
Output is correct |
60 |
Correct |
34 ms |
46936 KB |
Output is correct |
61 |
Correct |
33 ms |
46164 KB |
Output is correct |
62 |
Correct |
127 ms |
69500 KB |
Output is correct |
63 |
Correct |
199 ms |
70156 KB |
Output is correct |
64 |
Correct |
182 ms |
69712 KB |
Output is correct |
65 |
Correct |
170 ms |
69792 KB |
Output is correct |
66 |
Correct |
126 ms |
69588 KB |
Output is correct |
67 |
Correct |
175 ms |
69460 KB |
Output is correct |
68 |
Correct |
188 ms |
69708 KB |
Output is correct |
69 |
Correct |
185 ms |
69608 KB |
Output is correct |
70 |
Correct |
129 ms |
69460 KB |
Output is correct |
71 |
Correct |
136 ms |
69592 KB |
Output is correct |
72 |
Correct |
138 ms |
78672 KB |
Output is correct |
73 |
Correct |
128 ms |
74064 KB |
Output is correct |
74 |
Correct |
140 ms |
74116 KB |
Output is correct |
75 |
Correct |
147 ms |
69940 KB |
Output is correct |
76 |
Correct |
140 ms |
78676 KB |
Output is correct |
77 |
Correct |
119 ms |
70228 KB |
Output is correct |
78 |
Correct |
110 ms |
69460 KB |
Output is correct |
79 |
Correct |
99 ms |
78996 KB |
Output is correct |
80 |
Correct |
62 ms |
68292 KB |
Output is correct |
81 |
Correct |
57 ms |
68292 KB |
Output is correct |
82 |
Correct |
149 ms |
78908 KB |
Output is correct |
83 |
Correct |
179 ms |
70740 KB |
Output is correct |
84 |
Correct |
176 ms |
70868 KB |
Output is correct |
85 |
Correct |
154 ms |
79924 KB |
Output is correct |
86 |
Correct |
152 ms |
75348 KB |
Output is correct |
87 |
Correct |
145 ms |
75092 KB |
Output is correct |
88 |
Correct |
173 ms |
70996 KB |
Output is correct |
89 |
Correct |
139 ms |
79676 KB |
Output is correct |
90 |
Correct |
147 ms |
71260 KB |
Output is correct |
91 |
Correct |
165 ms |
70804 KB |
Output is correct |
92 |
Correct |
143 ms |
79084 KB |
Output is correct |
93 |
Correct |
946 ms |
207956 KB |
Output is correct |
94 |
Correct |
903 ms |
207284 KB |
Output is correct |
95 |
Correct |
751 ms |
225696 KB |
Output is correct |
96 |
Correct |
796 ms |
216548 KB |
Output is correct |
97 |
Correct |
813 ms |
216292 KB |
Output is correct |
98 |
Correct |
1026 ms |
208464 KB |
Output is correct |
99 |
Correct |
767 ms |
225524 KB |
Output is correct |
100 |
Correct |
831 ms |
208320 KB |
Output is correct |
101 |
Correct |
836 ms |
207672 KB |
Output is correct |
102 |
Correct |
483 ms |
225364 KB |
Output is correct |
103 |
Correct |
239 ms |
139088 KB |
Output is correct |
104 |
Correct |
204 ms |
138900 KB |
Output is correct |
105 |
Correct |
750 ms |
224456 KB |
Output is correct |
106 |
Correct |
826 ms |
224640 KB |
Output is correct |