QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430771#6452. Ski ResortLittle09TL 26ms65136kbC++175.1kb2024-06-04 14:14:322024-06-04 14:14:33

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 60996kb

input:

4 4 4
1 2
1 3
2 4
3 4
1 1 4
2 1 4
1 1 3
2 2 3 2

output:

2
0
2
1

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 10ms
memory: 58996kb

input:

8 10 4
1 2
2 3
1 3
3 6
6 8
2 4
2 5
4 7
5 7
7 8
2 3 4 5 6
2 2 6 8
1 1 6
1 1 8

output:

0
0
3
2

result:

ok 4 lines

Test #3:

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

input:

8 9 4
1 2
1 3
3 6
6 8
2 4
2 5
4 7
5 7
7 8
2 3 4 5 6
2 2 6 8
1 1 6
1 1 8

output:

2
0
3
2

result:

ok 4 lines

Test #4:

score: 0
Accepted
time: 12ms
memory: 65104kb

input:

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

output:

9
2

result:

ok 2 lines

Test #5:

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

input:

8 8 1020
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
4 3 2 4 5
3 6 1 2 3 6 7 8
4 5 2 3 4 5 8
3 4 1 3 4 8
3 3 1 4 6
4 4 1 2 5 6
3 1 2
1 6 1 2 3 4 6 7
4 3 1 5 7
3 4 1 2 6 8
1 1 4
3 5 3 4 5 7 8
2 4 1 4 5 7
1 3 1 2 7
1 3 4 6 8
4 4 1 2 3 8
2 2 3 4
4 3 3 6 8
4 6 1 4 5 6 7 8
4 6 1 2 4 5 6 7
1 4 3 5 7 8
4 4 1 4 6 7
2 1...

output:

0
0
0
0
0
0
0
1
0
0
3
0
0
1
1
0
2
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
3
1
1
0
0
0
1
0
4
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
2
0
0
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
4
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
9
1
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
0
...

result:

ok 1020 lines

Test #6:

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

input:

8 9 2
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
4 3
2 2 5 7
1 1 8

output:

3
2

result:

ok 2 lines

Test #7:

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

input:

8 9 1020
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
4 3
1 4 1 2 5 7
4 2 2 4
4 4 2 5 7 8
1 5 2 4 5 6 7
2 4 2 4 6 8
2 6 2 3 4 5 6 8
4 2 2 3
3 3 3 4 8
1 4 2 3 6 7
2 4 1 5 6 8
4 4 2 4 6 8
3 3 1 3 7
4 4 4 5 7 8
4 5 1 2 3 4 5
3 4 1 4 6 7
3 3 3 4 5
2 4 2 3 5 8
2 3 2 6 8
4 1 3
4 2 3 5
2 2 2 6
4 6 1 2 3 4 5 6
2 2 1 5
3...

output:

1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
4
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
3
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
1
0
...

result:

ok 1020 lines

Test #8:

score: 0
Accepted
time: 4ms
memory: 58896kb

input:

8 9 2
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
6 2
2 2 5 7
1 1 8

output:

3
2

result:

ok 2 lines

Test #9:

score: 0
Accepted
time: 7ms
memory: 61256kb

input:

8 9 1020
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
6 2
2 5 1 3 5 6 8
4 4 1 3 4 5
2 3 5 7 8
2 3 1 3 5
1 3 1 4 6
1 4 1 3 6 8
4 5 1 3 5 7 8
3 4 1 3 4 7
2 6 1 2 3 6 7 8
2 4 1 5 6 7
2 1 4
4 4 1 4 5 6
1 1 7
2 3 1 3 8
4 3 1 4 8
1 4 3 5 6 7
3 3 1 6 8
1 5 3 4 5 6 7
1 3 1 2 3
3 4 2 4 6 8
4 3 2 4 6
1 6 2 3 4 5 6 7
3 2 5...

output:

0
0
0
0
1
1
0
0
0
0
0
0
4
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
3
0
1
1
0
1
1
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
1
0
1
1
0
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
...

result:

ok 1020 lines

Test #10:

score: 0
Accepted
time: 4ms
memory: 58948kb

input:

8 9 2
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
4 6
2 2 5 7
1 1 8

output:

2
2

result:

ok 2 lines

Test #11:

score: 0
Accepted
time: 7ms
memory: 61256kb

input:

8 9 1020
1 2
1 3
2 4
4 5
5 8
3 6
6 7
7 8
4 6
1 3 2 4 7
4 1 8
4 3 4 7 8
1 5 1 2 6 7 8
1 3 1 5 8
3 7 1 2 3 4 5 6 7
2 6 2 3 4 5 7 8
4 1 4
3 4 3 5 6 8
1 3 2 7 8
1 3 3 5 8
1 3 2 5 8
1 3 1 4 5
2 3 1 3 6
4 4 5 6 7 8
2 3 3 6 7
4 5 2 3 4 5 7
2 5 2 3 4 5 7
4 3 3 6 7
3 4 1 4 5 7
1 5 3 4 5 6 7
3 6 3 4 5 6 7 8
3...

output:

1
0
0
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
3
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
0
0
0
1
1
0
...

result:

ok 1020 lines

Test #12:

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

input:

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

output:

0
1715
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
84
140
0
0
0
0
0
0
0
0
0
0
420
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
108
0
0
24
105
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 70 lines

Test #13:

score: 0
Accepted
time: 11ms
memory: 60984kb

input:

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

output:

0
20
0
0
0
0
60
0
0
0
0
0
120
0
0
20
0
112
96
0
0
0
18
0
6
0
196
0
28
0
0
14
49
0
0
36
0
24
10
0
0
0
0
75
0
63
0
16
0
0
0
0
90
0
64
0
0
0
84
0
0
0
0
0
0
0
28
0
0
0

result:

ok 70 lines

Test #14:

score: 0
Accepted
time: 7ms
memory: 58892kb

input:

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

output:

6
30
18
5
0
0
0
6
7
4
8
8
0
12
35
0
24
5
6
0
0
0
30
0
0
8
6
3
30
0
2
0
6
0
2
0
5
0
0
0
21
24
1
2
0
0
0
18
49
8
1
15
35
35
12
14
30
20
9
0
0
4
28
0
18
4
14
15
20
0

result:

ok 70 lines

Test #15:

score: 0
Accepted
time: 6ms
memory: 54956kb

input:

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

output:

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

result:

ok 30 lines

Test #16:

score: 0
Accepted
time: 26ms
memory: 64996kb

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
432
672
144
72
0
0
0
48
0
0
0
0
0
0
0
0
1764
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
64
0
0
0
0
0
0
0
0
0
840
0
0
0
0
0
200
0
0
0
0
0
0
0
0
0
0
0
0
0
0
840
0
96
0
0
0
0
0
0
0
336
0
0
0
0
0
36
0
0
0
0
252
0
0
0
0
0
0
0
0
300
0
0
0
0
0
0
0
0
0
0
840
0
0
0
0
0
0
0
0
84
0
0...

result:

ok 19405 lines

Test #17:

score: 0
Accepted
time: 4ms
memory: 56888kb

input:

30 38 70
1 2
2 3
3 4
4 5
5 6
6 7
7 8
1 9
9 10
10 11
11 12
12 13
13 14
14 15
1 16
16 17
17 18
18 19
19 20
20 21
21 22
1 23
23 24
24 25
25 26
26 27
27 28
28 29
16 23
18 23
27 2
28 2
2 9
3 9
15 30
29 30
22 30
8 30
4 4 20 23 29 30
4 4 1 11 26 30
4 4 3 16 18 23
4 4 5 17 19 24
4 4 7 16 18 19
4 4 5 10 18 3...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 70 lines

Test #18:

score: 0
Accepted
time: 4ms
memory: 65136kb

input:

20 23 6195
20 19
7 20
6 9
1 15
17 5
17 4
8 11
8 7
11 6
2 10
8 14
19 12
4 18
14 13
12 14
18 16
5 2
15 3
13 17
16 5
10 9
10 11
3 8
4 4 6 7 15 16
4 4 4 8 10 16
4 4 8 10 15 20
4 4 1 5 9 18
4 4 3 7 14 17
4 4 3 5 16 17
4 4 6 8 10 18
4 4 5 6 11 15
4 4 8 11 15 18
4 4 4 11 18 19
4 4 4 8 11 17
4 4 3 5 6 12
4 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 6195 lines

Test #19:

score: 0
Accepted
time: 9ms
memory: 57172kb

input:

20 19 6195
19 20
6 18
15 11
1 6
20 5
19 9
15 3
18 17
16 7
18 12
6 16
14 8
9 15
10 4
16 13
10 2
9 10
20 14
1 19
2 2 1 6
4 4 5 6 11 12
4 4 1 9 15 19
4 4 11 12 14 18
4 4 6 11 13 17
4 4 4 10 18 19
3 3 5 9 13
4 4 5 11 13 20
4 4 1 9 10 15
4 4 3 5 18 19
4 4 4 10 14 16
4 4 6 7 11 17
4 4 3 10 14 18
4 4 8 10 ...

output:

0
0
0
0
0
0
6
0
0
0
0
0
8
0
0
9
0
0
24
0
0
12
2
0
0
0
6
0
0
0
12
18
0
0
4
0
0
0
0
0
0
0
0
24
0
0
2
0
0
0
0
3
0
0
0
0
0
18
0
0
16
0
0
4
6
27
0
0
0
8
0
0
0
0
0
0
0
24
0
0
8
0
4
0
0
0
6
4
0
0
4
0
0
0
0
1
0
0
0
0
4
0
0
0
0
0
0
0
0
0
1
0
0
6
0
6
8
0
0
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
6
0
3
0
4
0
0
9
4
0
0
0...

result:

ok 6195 lines

Test #20:

score: 0
Accepted
time: 7ms
memory: 58872kb

input:

20 19 6195
1 20
12 18
4 15
4 5
14 7
13 16
13 12
19 4
11 13
14 17
7 8
1 19
13 14
19 9
11 2
1 3
16 10
11 6
1 11
4 4 2 9 10 19
3 3 3 7 11
4 4 2 4 8 19
3 3 1 6 13
4 4 3 6 7 13
4 4 1 5 7 17
4 4 3 8 9 15
4 4 2 9 13 17
4 4 3 14 18 20
4 4 2 10 15 16
4 4 2 7 13 16
4 4 3 10 17 18
4 4 2 11 13 17
4 4 4 6 7 14
4...

output:

0
0
0
0
0
0
10
0
2
0
0
8
0
0
0
0
0
0
2
2
0
0
0
0
0
0
3
4
0
2
0
5
0
4
0
0
0
0
3
0
0
0
0
4
0
1
0
4
0
2
2
0
0
0
1
1
3
6
0
8
0
2
0
1
0
0
0
0
0
0
0
0
0
4
0
0
0
6
0
0
0
6
0
0
12
0
4
0
6
0
4
0
0
8
6
6
0
0
0
4
0
2
0
0
0
0
0
0
6
12
4
0
2
12
0
0
0
0
6
0
3
1
3
0
0
0
0
0
2
0
0
2
0
2
0
0
3
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 6195 lines

Test #21:

score: -100
Time Limit Exceeded

input:

99998 100000 40018
56803 56804
28456 28457
7503 7504
57479 57480
60467 60468
49082 49083
96091 96092
12177 12178
14718 14719
91546 91547
32280 32281
24589 24590
68619 68620
48993 48994
66820 66821
79526 79527
66592 66593
50885 50886
6647 6648
89570 89571
95095 95096
37593 37594
95870 95871
77917 779...

output:

0
0
298286769040
0
0
0
1
1
0
1
0
194683976
0
0
0
0
1
0
1
0
0
0
0
0
1555840698120
0
0
0
1
0
69776636013
0
0
0
1
0
1
0
1
9807
1
1
14289386090658252
1
1
0
8282
38189520
0
0
361
1311799507285176
911661274353
0
1
0
0
0
2542706031866
0
0
0
149344635
0
0
154279471
1
1
1
0
0
1
1
26733661808
544261562
887482...

result: