QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601704#4122. 嫁接树GuanYunchang100 ✓869ms19380kbC++202.3kb2024-09-30 11:17:152024-09-30 11:17:16

详细


Pretests


Final Tests

Test #1:

score: 5
Accepted
time: 21ms
memory: 18508kb

input:

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

output:

66022.383

result:

ok single line: '66022.383'

Test #2:

score: 5
Accepted
time: 23ms
memory: 19048kb

input:

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

output:

69617.050

result:

ok single line: '69617.050'

Test #3:

score: 5
Accepted
time: 25ms
memory: 17428kb

input:

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

output:

73247.333

result:

ok single line: '73247.333'

Test #4:

score: 5
Accepted
time: 21ms
memory: 19248kb

input:

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

output:

76902.517

result:

ok single line: '76902.517'

Test #5:

score: 5
Accepted
time: 26ms
memory: 18140kb

input:

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

output:

84305.667

result:

ok single line: '84305.667'

Test #6:

score: 5
Accepted
time: 24ms
memory: 17720kb

input:

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

output:

0.606

result:

ok single line: '0.606'

Test #7:

score: 5
Accepted
time: 24ms
memory: 19380kb

input:

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

output:

0.203

result:

ok single line: '0.203'

Test #8:

score: 5
Accepted
time: 21ms
memory: 18248kb

input:

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

output:

0.068

result:

ok single line: '0.068'

Test #9:

score: 5
Accepted
time: 27ms
memory: 17936kb

input:

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

output:

0.088

result:

ok single line: '0.088'

Test #10:

score: 5
Accepted
time: 24ms
memory: 18464kb

input:

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

output:

0.155

result:

ok single line: '0.155'

Test #11:

score: 5
Accepted
time: 36ms
memory: 13120kb

input:

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

output:

12084.733

result:

ok single line: '12084.733'

Test #12:

score: 5
Accepted
time: 622ms
memory: 12852kb

input:

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

output:

12869.817

result:

ok single line: '12869.817'

Test #13:

score: 5
Accepted
time: 682ms
memory: 15108kb

input:

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

output:

13659.067

result:

ok single line: '13659.067'

Test #14:

score: 5
Accepted
time: 51ms
memory: 15160kb

input:

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

output:

14445.067

result:

ok single line: '14445.067'

Test #15:

score: 5
Accepted
time: 869ms
memory: 15328kb

input:

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

output:

16042.017

result:

ok single line: '16042.017'

Test #16:

score: 5
Accepted
time: 45ms
memory: 14940kb

input:

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

output:

0.285

result:

ok single line: '0.285'

Test #17:

score: 5
Accepted
time: 694ms
memory: 13112kb

input:

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

output:

0.143

result:

ok single line: '0.143'

Test #18:

score: 5
Accepted
time: 42ms
memory: 14980kb

input:

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

output:

0.071

result:

ok single line: '0.071'

Test #19:

score: 5
Accepted
time: 809ms
memory: 15272kb

input:

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

output:

0.095

result:

ok single line: '0.095'

Test #20:

score: 5
Accepted
time: 862ms
memory: 13336kb

input:

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

output:

0.189

result:

ok single line: '0.189'