QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261654#1496. Cow at LargeGMBox100 ✓115ms9212kbC++172.4kb2023-11-23 06:41:562023-11-23 06:41:56

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 9.09091
Accepted
time: 1ms
memory: 5488kb

input:

7
1 2
1 3
3 4
3 5
4 6
5 7

output:

3
1
3
3
3
1
1

result:

ok 7 lines

Test #2:

score: 9.09091
Accepted
time: 8ms
memory: 5688kb

input:

10000
2 1
3 1
4 2
5 3
6 1
7 5
8 6
9 4
10 2
11 9
12 7
13 1
14 7
15 3
16 9
17 12
18 1
19 14
20 17
21 6
22 4
23 20
24 9
25 8
26 21
27 2
28 5
29 7
30 26
31 16
32 27
33 26
34 31
35 5
36 4
37 25
38 28
39 37
40 6
41 32
42 17
43 33
44 7
45 10
46 26
47 31
48 36
49 4
50 1
51 50
52 12
53 11
54 17
55 1
56 29
57...

output:

25
18
12
17
32
20
35
13
17
4
12
31
8
12
19
14
34
4
8
10
11
10
8
8
13
19
8
5
22
6
13
7
11
10
6
18
6
14
4
12
5
7
9
22
7
6
11
6
15
3
4
16
7
9
8
11
15
14
9
11
1
15
4
15
4
10
10
12
20
19
6
6
5
12
5
6
27
7
3
9
5
13
2
5
8
12
10
13
11
12
10
11
16
24
3
4
19
14
8
4
13
7
8
10
6
7
17
12
6
7
6
5
2
13
8
7
5
3
6
1...

result:

ok 10000 lines

Test #3:

score: 9.09091
Accepted
time: 71ms
memory: 8780kb

input:

70000
2 1
3 1
4 1
5 4
6 4
7 2
8 2
9 2
10 4
11 9
12 6
13 2
14 8
15 4
16 1
17 13
18 6
19 14
20 5
21 7
22 12
23 11
24 19
25 21
26 10
27 14
28 23
29 4
30 13
31 20
32 20
33 7
34 33
35 29
36 21
37 19
38 11
39 21
40 30
41 27
42 10
43 37
44 1
45 12
46 29
47 3
48 40
49 27
50 22
51 10
52 42
53 20
54 53
55 34
...

output:

14
19
15
41
4
18
15
5
15
16
24
33
20
32
15
22
8
20
9
26
14
14
16
24
34
27
19
32
16
7
6
12
13
8
23
21
21
18
16
14
14
32
14
15
9
9
19
21
18
41
20
16
12
5
17
16
15
21
7
23
7
20
20
12
5
14
20
32
4
9
18
12
24
9
22
16
6
20
15
11
14
7
16
18
22
11
9
9
14
23
16
13
8
12
3
5
11
6
14
17
13
16
8
2
4
26
11
10
11
...

result:

ok 70000 lines

Test #4:

score: 9.09091
Accepted
time: 63ms
memory: 8900kb

input:

70000
2 1
3 1
4 3
5 4
6 3
7 6
8 6
9 7
10 8
11 3
12 3
13 8
14 6
15 1
16 1
17 12
18 15
19 15
20 6
21 11
22 4
23 19
24 18
25 21
26 19
27 9
28 22
29 3
30 16
31 23
32 30
33 13
34 28
35 26
36 14
37 3
38 12
39 15
40 33
41 25
42 20
43 2
44 25
45 10
46 9
47 33
48 14
49 2
50 41
51 48
52 24
53 24
54 30
55 2
56...

output:

33
24
28
22
9
20
23
15
37
14
18
37
21
24
32
21
30
28
41
20
30
12
29
14
36
16
23
23
31
21
15
3
12
7
16
11
11
23
24
23
18
8
10
18
15
17
28
20
5
14
23
7
17
15
14
28
24
12
36
11
23
10
21
24
14
9
12
24
5
10
6
5
18
22
13
13
23
23
18
34
11
7
18
20
13
34
5
9
19
19
15
25
23
14
17
25
16
13
32
31
12
18
23
16
6...

result:

ok 70000 lines

Test #5:

score: 9.09091
Accepted
time: 73ms
memory: 8852kb

input:

70000
2 1
3 2
4 1
5 2
6 2
7 5
8 6
9 4
10 3
11 9
12 4
13 6
14 9
15 2
16 15
17 7
18 2
19 14
20 5
21 18
22 2
23 11
24 14
25 12
26 23
27 13
28 14
29 13
30 15
31 29
32 9
33 18
34 24
35 4
36 9
37 35
38 24
39 2
40 30
41 40
42 31
43 37
44 27
45 35
46 34
47 18
48 15
49 45
50 30
51 44
52 44
53 43
54 22
55 38
...

output:

25
45
51
37
26
28
16
11
23
15
17
6
31
39
29
17
10
42
10
15
13
25
16
9
16
39
7
6
25
56
10
13
16
8
12
15
14
18
21
29
26
24
10
15
14
13
7
19
15
23
13
6
6
17
6
28
7
14
13
16
22
8
18
18
14
13
4
22
16
7
12
21
22
37
19
21
16
19
7
38
18
13
8
19
15
14
5
4
2
11
20
22
3
10
15
14
16
4
16
10
13
14
6
11
12
6
27
1...

result:

ok 70000 lines

Test #6:

score: 9.09091
Accepted
time: 66ms
memory: 8840kb

input:

70000
2 1
3 2
4 1
5 1
6 1
7 5
8 1
9 3
10 7
11 10
12 4
13 2
14 2
15 14
16 4
17 12
18 13
19 11
20 6
21 13
22 2
23 5
24 18
25 23
26 20
27 23
28 22
29 26
30 22
31 28
32 4
33 14
34 4
35 6
36 5
37 34
38 18
39 2
40 12
41 7
42 36
43 21
44 25
45 25
46 39
47 45
48 37
49 34
50 13
51 3
52 20
53 49
54 26
55 10
5...

output:

40
27
26
14
22
18
25
14
10
36
40
17
50
39
21
44
14
15
15
7
16
29
24
7
18
28
12
23
17
18
17
13
7
37
6
16
9
7
32
23
16
8
36
18
31
30
3
21
14
11
5
8
15
14
27
22
12
13
18
17
10
7
11
26
16
11
22
24
24
12
17
13
26
21
27
7
28
19
9
14
19
20
4
23
25
10
3
10
20
23
19
6
13
12
9
7
26
6
10
19
10
12
26
18
21
12
1...

result:

ok 70000 lines

Test #7:

score: 9.09091
Accepted
time: 111ms
memory: 8964kb

input:

70000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51
53 52...

output:

1
18
18
18
18
18
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
1...

result:

ok 70000 lines

Test #8:

score: 9.09091
Accepted
time: 104ms
memory: 8876kb

input:

70000
2 1
3 2
4 3
5 3
6 4
7 6
8 7
9 8
10 5
11 10
12 1
13 9
14 13
15 14
16 12
17 11
18 17
19 15
20 19
21 18
22 21
23 16
24 20
25 24
26 23
27 22
28 26
29 25
30 27
31 28
32 31
33 30
34 32
35 34
36 35
37 36
38 37
39 38
40 29
41 39
42 40
43 33
44 43
45 44
46 45
47 41
48 42
49 46
50 48
51 50
52 47
53 52
5...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 70000 lines

Test #9:

score: 9.09091
Accepted
time: 99ms
memory: 9212kb

input:

70000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51
53 52...

output:

1
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
11
11
11
11
1...

result:

ok 70000 lines

Test #10:

score: 9.09091
Accepted
time: 92ms
memory: 9136kb

input:

70000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51
53 52...

output:

1
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4...

result:

ok 70000 lines

Test #11:

score: 9.09091
Accepted
time: 115ms
memory: 8692kb

input:

70000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51
53 52...

output:

1
17
17
17
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
1...

result:

ok 70000 lines