QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#504019#4709. Routing a Marathon Racexiaowuc1AC ✓41ms3828kbC++174.0kb2024-08-04 04:02:502024-08-04 04:02:55

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

40 60
96
97
95
93
95
96
92
99
91
92
97
90
99
93
96
90
96
92
96
91
98
97
99
92
90
92
93
97
95
99
92
92
98
99
97
93
96
91
92
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

849

result:

ok single line: '849'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

40 60
98
91
98
96
98
92
94
97
92
96
95
96
98
96
95
97
91
98
92
99
99
97
97
99
99
99
95
92
92
96
91
91
94
96
94
92
98
95
98
97
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

864

result:

ok single line: '864'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

40 60
99
96
99
97
94
92
97
93
95
98
95
97
97
97
93
98
97
99
94
94
96
93
95
99
99
94
98
92
99
97
94
98
94
93
96
96
93
93
97
97
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

389

result:

ok single line: '389'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

40 60
98
93
93
99
93
94
98
94
98
93
97
94
95
97
97
99
95
95
95
97
99
99
99
98
94
96
98
93
95
98
97
99
96
95
98
97
96
95
96
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1347

result:

ok single line: '1347'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

40 60
99
98
96
95
95
97
95
96
99
96
94
98
96
95
94
98
95
97
99
99
96
94
97
97
98
94
98
94
98
94
99
98
96
95
97
98
98
99
94
95
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1151

result:

ok single line: '1151'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

40 60
95
95
97
96
97
95
99
98
96
96
98
95
98
95
95
95
96
98
96
99
95
99
98
96
95
98
98
97
97
96
97
99
98
99
96
95
96
95
95
98
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

964

result:

ok single line: '964'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

40 60
97
96
97
96
97
98
99
98
98
99
99
97
97
98
96
96
96
99
96
99
98
96
98
97
99
96
96
97
99
99
98
96
99
96
97
96
98
96
99
97
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

970

result:

ok single line: '970'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

40 60
97
99
98
99
97
99
98
97
98
99
98
98
97
98
97
98
99
99
97
99
99
97
99
98
98
98
97
98
99
97
98
97
99
97
99
97
97
98
98
98
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

491

result:

ok single line: '491'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

40 60
98
98
99
99
99
98
99
99
99
99
99
98
99
99
98
98
98
99
99
99
98
99
98
98
99
98
99
99
99
99
98
98
99
99
99
99
99
99
98
98
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1281

result:

ok single line: '1281'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

40 60
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

990

result:

ok single line: '990'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

40 60
98
98
95
98
97
95
91
97
97
93
93
98
93
94
91
90
98
91
98
98
94
95
91
92
98
92
93
98
96
97
93
97
98
90
95
95
95
99
92
93
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1140

result:

ok single line: '1140'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

40 60
96
97
99
97
95
95
98
96
92
93
97
93
96
99
92
92
93
92
97
97
95
92
95
96
99
98
96
92
92
96
95
95
93
95
91
97
97
98
92
98
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1352

result:

ok single line: '1352'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

40 60
94
94
92
95
99
97
93
93
92
94
97
97
98
92
92
95
95
99
96
98
92
96
94
98
92
95
94
94
97
96
94
99
99
94
95
98
99
96
99
92
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1444

result:

ok single line: '1444'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

40 60
99
93
95
98
95
93
94
96
99
98
97
93
95
95
94
97
93
99
95
98
98
94
95
97
97
97
93
95
96
98
99
95
97
95
99
97
95
98
98
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1062

result:

ok single line: '1062'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

40 60
96
97
94
95
96
99
94
97
98
94
98
94
94
96
99
96
96
95
99
96
95
97
94
98
98
98
98
99
97
94
98
98
97
96
99
97
95
99
99
94
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1448

result:

ok single line: '1448'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

40 60
95
97
95
96
95
99
97
98
98
98
97
99
99
95
95
99
97
99
98
95
95
98
96
95
96
98
96
95
98
95
95
95
99
95
98
95
95
96
98
95
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1643

result:

ok single line: '1643'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

40 60
97
97
96
99
99
99
99
99
96
97
97
99
99
96
98
97
96
97
97
99
98
97
98
98
97
96
96
99
96
96
96
97
97
96
96
97
96
99
96
96
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1164

result:

ok single line: '1164'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

40 60
98
99
99
98
99
98
97
99
99
98
97
99
97
97
99
97
97
97
97
99
99
97
99
98
99
98
98
98
99
97
98
98
97
98
97
99
99
97
97
97
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1271

result:

ok single line: '1271'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

40 60
98
99
99
98
98
99
98
98
99
98
99
98
98
98
99
98
98
99
99
98
99
99
99
98
99
99
99
98
98
98
99
99
98
98
99
98
98
99
98
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

886

result:

ok single line: '886'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

40 60
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33...

output:

1089

result:

ok single line: '1089'

Test #21:

score: 0
Accepted
time: 41ms
memory: 3592kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #22:

score: 0
Accepted
time: 41ms
memory: 3488kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #23:

score: 0
Accepted
time: 41ms
memory: 3480kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #24:

score: 0
Accepted
time: 41ms
memory: 3620kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #25:

score: 0
Accepted
time: 41ms
memory: 3536kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #26:

score: 0
Accepted
time: 41ms
memory: 3596kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #27:

score: 0
Accepted
time: 41ms
memory: 3552kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #28:

score: 0
Accepted
time: 41ms
memory: 3524kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #29:

score: 0
Accepted
time: 41ms
memory: 3780kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #30:

score: 0
Accepted
time: 41ms
memory: 3828kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #31:

score: 0
Accepted
time: 41ms
memory: 3592kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #32:

score: 0
Accepted
time: 41ms
memory: 3488kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #33:

score: 0
Accepted
time: 41ms
memory: 3592kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #34:

score: 0
Accepted
time: 41ms
memory: 3488kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #35:

score: 0
Accepted
time: 41ms
memory: 3544kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #36:

score: 0
Accepted
time: 41ms
memory: 3532kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #37:

score: 0
Accepted
time: 41ms
memory: 3816kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #38:

score: 0
Accepted
time: 37ms
memory: 3600kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #39:

score: 0
Accepted
time: 37ms
memory: 3480kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #40:

score: 0
Accepted
time: 41ms
memory: 3480kb

input:

40 106
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1 2
1 3
1 4
2 5
2 6
2 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 1...

output:

3900

result:

ok single line: '3900'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

40 233
11
15
10
8
13
14
5
12
6
6
14
5
7
15
9
6
6
7
13
2
94
56
15
94
50
47
63
2
10
32
30
99
5
72
61
5
34
94
15
15
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 40
1 20
1 23
1 29
1 33
1 36
1 39
2 20
2 23
2 28
2 29
2 33
2 36
2 39
3 20
3 23
3 28
3 29
3 33
...

output:

251

result:

ok single line: '251'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

40 273
15
14
8
6
10
15
8
14
6
15
5
8
14
13
14
14
13
12
6
7
41
80
11
4
1
98
87
9
9
90
7
58
6
4
31
10
59
70
1
8
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 40
1 20
1 23
1 25
1 28
1 29
1 31
1 33
1 34
1 36
1 39
2 20
2 23
2 24
2 25
2 28
2 31
2 33
2 34
3 2...

output:

287

result:

ok single line: '287'

Test #43:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

40 226
12
6
9
6
12
12
7
5
15
13
11
10
14
9
9
8
7
5
12
7
70
34
6
3
2
4
88
6
7
73
4
30
8
8
76
7
78
81
4
10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 40
1 20
1 23
1 25
1 26
1 28
1 29
1 31
1 33
1 34
1 36
1 39
2 20
2 23
2 24
2 25
2 28
2 31
2 36
2 39
3 2...

output:

258

result:

ok single line: '258'

Test #44:

score: 0
Accepted
time: 3ms
memory: 3488kb

input:

40 134
1
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1 5
1 6
1 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 13
11 14
11 15
11 16
12 14
12 15
12 16
13 14
13 15
13 16
14 17
14 18
14 19
15 17
15 18
15 1...

output:

39

result:

ok single line: '39'

Test #45:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

40 134
1
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1 5
1 6
1 7
3 5
3 6
3 7
4 5
4 6
4 7
5 8
5 9
5 10
6 8
6 9
6 10
7 8
7 9
7 10
8 11
8 12
8 13
9 11
9 12
9 13
10 11
10 12
10 13
11 14
11 15
11 16
12 14
12 15
12 16
13 14
13 15
13 16
14 17
14 18
14 19
15 17
15 18
15 1...

output:

39

result:

ok single line: '39'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

40 67
14
85
77
26
50
45
66
79
10
3
84
44
77
1
45
73
23
95
91
4
3
55
94
39
22
43
3
23
44
50
24
24
22
46
29
3
84
56
65
19
1 2
2 3
3 4
4 5
6 7
7 8
8 9
9 10
11 12
12 13
13 14
14 15
16 17
17 18
18 19
19 20
21 22
22 23
23 24
24 25
26 27
27 28
28 29
29 30
31 32
32 33
33 34
34 35
36 37
37 38
38 39
39 40
1 6...

output:

910

result:

ok single line: '910'

Test #47:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

40 67
96
95
6
9
84
74
67
31
61
61
59
16
44
40
73
100
95
55
45
27
4
3
47
32
39
90
53
57
24
3
33
14
52
100
68
19
90
80
74
91
1 2
2 3
3 4
4 5
5 6
6 7
7 8
9 10
10 11
11 12
12 13
13 14
14 15
15 16
17 18
18 19
19 20
20 21
21 22
22 23
23 24
25 26
26 27
27 28
28 29
29 30
30 31
31 32
33 34
34 35
35 36
36 37
...

output:

971

result:

ok single line: '971'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

36 60
24
55
37
61
63
7
2
84
26
24
100
48
84
48
64
16
64
87
53
75
68
7
76
60
31
4
87
48
72
88
72
93
40
81
45
94
1 2
2 3
3 4
4 5
5 6
7 8
8 9
9 10
10 11
11 12
13 14
14 15
15 16
16 17
17 18
19 20
20 21
21 22
22 23
23 24
25 26
26 27
27 28
28 29
29 30
31 32
32 33
33 34
34 35
35 36
1 7
2 8
3 9
4 10
5 11
6 ...

output:

1002

result:

ok single line: '1002'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

36 59
1
1
1
1
10
10
10
1
100
100
10
1
10
10
10
1
1
1
1
1
1
10
10
10
1
10
100
100
1
10
10
10
1
1
1
1
1 2
2 3
3 4
5 6
6 7
7 8
9 10
10 11
11 12
13 14
14 15
15 16
17 18
18 19
19 20
21 22
22 23
23 24
25 26
26 27
27 28
29 30
30 31
31 32
33 34
34 35
35 36
1 5
2 6
3 7
4 8
5 9
6 10
7 11
8 12
9 13
10 14
11 15...

output:

138

result:

ok single line: '138'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

40 780
30
36
33
75
51
53
15
92
33
33
7
98
48
92
93
97
82
93
93
81
14
53
58
100
79
71
75
37
95
65
41
47
98
54
17
15
69
57
91
19
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1...

output:

2390

result:

ok single line: '2390'

Test #51:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

40 779
91
12
60
7
24
19
1
41
51
29
66
6
52
53
41
92
13
43
46
38
98
58
52
44
44
96
80
65
17
60
13
36
3
71
98
64
57
26
45
47
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
...

output:

1859

result:

ok single line: '1859'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

40 775
78
41
100
93
30
94
19
10
73
30
52
64
5
75
28
44
35
75
75
29
11
30
42
8
16
77
71
98
98
88
38
17
32
47
53
55
36
86
29
47
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 ...

output:

2029

result:

ok single line: '2029'

Test #53:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

40 760
67
89
40
92
11
93
89
98
84
72
44
72
88
58
63
93
29
34
4
88
63
68
24
19
48
88
36
43
42
85
13
87
2
70
77
47
75
29
15
36
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 3...

output:

2275

result:

ok single line: '2275'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

2 1
2
3
1 2

output:

5

result:

ok single line: '5'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

3 2
2
3
4
1 2
2 3

output:

9

result:

ok single line: '9'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

3 3
2
3
4
1 2
2 3
1 3

output:

9

result:

ok single line: '9'

Test #57:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

3 2
2
3
4
1 2
1 3

output:

9

result:

ok single line: '9'