QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#274212#7600. Minimums on the EdgesMaMengQiAC ✓48ms3636kbC++17849b2023-12-03 12:55:282023-12-03 12:55:28

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3448kb

input:

4 4 6
1 2
2 3
3 1
1 4

output:

2 2 2 0 

result:

ok answer = 6

Test #2:

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

input:

3 7 7
1 2
1 2
1 2
1 3
1 3
2 3
2 3

output:

3 2 2 

result:

ok answer = 14

Test #3:

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

input:

5 10 61
5 3
1 2
4 5
2 3
2 1
3 1
1 5
3 5
2 4
2 1

output:

15 15 15 1 15 

result:

ok answer = 122

Test #4:

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

input:

5 10 6
1 4
3 4
4 3
1 4
5 1
4 3
3 2
1 3
5 2
2 3

output:

2 0 2 2 0 

result:

ok answer = 12

Test #5:

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

input:

5 10 85
3 1
4 5
4 1
4 5
1 5
2 3
4 5
1 4
3 2
2 3

output:

27 2 2 27 27 

result:

ok answer = 170

Test #6:

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

input:

5 10 30
2 5
2 4
4 5
4 3
5 1
4 3
2 3
1 5
1 4
2 1

output:

6 6 6 6 6 

result:

ok answer = 60

Test #7:

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

input:

5 10 77
1 3
4 1
4 3
5 2
5 2
2 5
2 3
3 4
5 3
5 2

output:

0 38 1 0 38 

result:

ok answer = 154

Test #8:

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

input:

10 10000 4
5 3
6 1
7 8
2 10
3 6
7 5
6 8
1 5
6 5
10 8
1 9
4 5
2 10
8 10
8 6
6 4
3 4
7 9
1 3
10 7
1 10
4 10
1 10
7 6
3 7
10 5
3 7
1 6
1 9
4 5
8 9
5 9
9 5
6 2
8 10
4 3
3 5
6 8
6 10
5 2
9 6
7 8
8 5
4 10
6 2
1 4
4 2
3 2
1 4
8 1
5 2
1 7
1 5
1 2
6 2
5 6
6 9
1 6
10 5
4 1
4 10
7 2
3 5
3 10
5 2
4 8
2 4
10 1
5...

output:

0 0 0 0 1 1 1 1 0 0 

result:

ok answer = 1415

Test #9:

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

input:

10 10000 83
7 9
6 4
3 6
7 5
2 5
10 7
10 7
7 10
6 5
3 9
2 6
9 10
8 2
6 2
10 1
3 9
4 2
9 5
2 10
6 3
10 5
5 9
6 2
1 4
8 9
7 6
2 5
7 8
10 4
2 1
2 9
7 10
2 7
2 5
9 10
10 8
4 1
10 8
2 5
3 10
6 7
6 3
5 8
10 2
6 10
6 3
9 5
6 2
8 5
8 2
8 10
2 8
5 10
5 2
10 3
8 6
3 1
3 2
8 7
3 7
8 2
9 7
5 9
5 3
7 5
2 6
6 9
8 ...

output:

8 8 8 8 8 8 9 8 9 9 

result:

ok answer = 80726

Test #10:

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

input:

10 10000 28
8 3
7 5
10 9
6 2
1 9
4 7
4 7
7 1
10 6
10 5
5 3
8 3
3 1
3 1
8 1
4 7
5 6
4 10
3 2
4 8
2 4
9 7
8 7
10 9
9 10
2 1
6 1
7 1
2 8
5 10
1 4
5 8
1 3
8 3
4 3
9 2
5 1
4 6
10 1
10 2
5 4
9 3
10 2
5 9
2 1
7 4
1 8
4 8
3 9
9 6
3 6
5 1
2 7
4 3
2 8
8 10
1 7
4 1
3 9
1 2
1 9
8 4
9 5
1 5
6 4
1 6
6 7
2 7
10 4
...

output:

3 3 3 2 3 2 3 3 3 3 

result:

ok answer = 26312

Test #11:

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

input:

10 10000 6
9 7
10 4
7 4
6 8
9 4
10 9
9 3
5 7
7 9
9 1
7 3
5 2
3 4
1 9
9 2
1 3
5 3
3 6
10 9
10 5
10 2
3 9
6 4
6 8
1 5
7 10
4 8
7 8
7 1
8 6
5 1
8 7
3 6
6 2
10 5
5 2
10 4
8 6
7 8
8 7
9 2
7 8
4 9
9 6
8 2
1 3
7 4
8 6
1 7
4 3
1 6
8 2
6 9
4 10
2 5
3 5
8 1
8 7
8 6
8 10
9 8
4 10
1 10
2 10
7 8
1 6
6 8
8 10
1 1...

output:

1 0 1 1 0 0 1 0 1 1 

result:

ok answer = 3460

Test #12:

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

input:

10 10000 19
1 3
6 7
4 5
9 8
5 8
1 9
10 7
10 6
2 9
2 5
2 4
2 3
3 2
9 3
3 9
7 10
7 8
7 1
8 6
8 9
1 5
2 5
4 6
2 10
8 9
8 2
6 7
9 10
1 2
3 10
5 6
8 5
5 9
3 4
4 10
5 3
8 9
6 1
4 2
2 5
2 9
2 10
1 9
9 4
10 2
8 4
9 1
7 8
1 2
6 10
8 2
8 10
5 4
10 9
7 2
3 2
6 8
5 4
8 9
8 10
6 8
10 4
7 3
3 5
9 8
6 7
5 3
5 8
2 ...

output:

2 2 2 2 2 2 2 2 1 2 

result:

ok answer = 18048

Test #13:

score: 0
Accepted
time: 33ms
memory: 3452kb

input:

18 15 22
8 17
13 14
5 15
2 17
18 1
17 10
1 5
6 18
1 6
11 2
15 17
2 13
4 3
1 10
16 14

output:

3 1 0 0 3 3 0 0 0 3 0 0 0 0 3 0 3 3 

result:

ok answer = 25

Test #14:

score: 0
Accepted
time: 29ms
memory: 3344kb

input:

18 15 1
1 13
2 3
8 10
6 10
15 11
18 3
8 6
18 5
4 13
12 5
14 4
5 3
16 4
18 9
8 2

output:

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok answer = 0

Test #15:

score: 0
Accepted
time: 35ms
memory: 3456kb

input:

18 15 47
12 9
11 9
9 3
12 2
13 2
3 11
9 12
17 2
15 7
10 9
8 15
5 4
10 13
8 9
12 16

output:

0 5 8 0 0 0 0 0 8 5 8 8 5 0 0 0 0 0 

result:

ok answer = 60

Test #16:

score: 0
Accepted
time: 33ms
memory: 3352kb

input:

18 15 25
6 5
17 14
12 16
16 13
11 12
16 11
17 15
11 18
15 17
8 17
7 15
3 8
6 5
10 16
7 6

output:

0 0 0 0 5 5 5 0 0 0 0 0 0 0 5 0 5 0 

result:

ok answer = 30

Test #17:

score: 0
Accepted
time: 34ms
memory: 3452kb

input:

18 15 38
1 18
8 3
15 11
5 6
8 4
8 12
16 11
13 5
14 17
1 11
5 2
15 18
6 3
1 16
15 4

output:

8 0 0 0 0 0 0 0 0 0 8 0 0 0 7 8 0 7 

result:

ok answer = 45

Test #18:

score: 0
Accepted
time: 36ms
memory: 3504kb

input:

18 30 51
10 14
6 17
3 5
8 9
9 10
7 8
12 5
7 10
11 12
11 10
4 17
7 2
3 8
7 5
16 17
5 6
4 12
13 15
2 12
14 11
17 1
10 1
3 14
18 7
2 6
9 16
14 16
6 17
17 5
15 3

output:

3 4 3 3 4 4 4 3 3 3 3 4 0 3 0 3 4 0 

result:

ok answer = 90

Test #19:

score: 0
Accepted
time: 33ms
memory: 3464kb

input:

18 30 29
5 10
15 6
6 18
14 2
6 2
17 7
12 1
9 16
10 9
1 5
1 13
4 7
1 17
2 6
16 13
10 17
1 2
12 18
13 3
9 6
1 16
18 8
6 10
8 13
13 8
7 10
6 10
13 11
8 13
16 3

output:

2 2 2 0 2 2 2 3 2 2 0 1 3 0 0 2 2 2 

result:

ok answer = 53

Test #20:

score: 0
Accepted
time: 35ms
memory: 3408kb

input:

18 30 42
17 6
4 11
9 11
1 13
4 10
12 9
11 17
12 4
9 8
15 14
1 9
13 4
4 8
16 8
7 12
11 18
18 6
7 9
7 6
14 11
3 9
9 18
15 2
18 10
8 16
15 3
14 6
10 2
9 3
13 5

output:

0 3 3 3 0 3 3 3 3 3 3 3 0 3 3 3 0 3 

result:

ok answer = 72

Test #21:

score: 0
Accepted
time: 33ms
memory: 3508kb

input:

18 30 20
10 3
13 18
10 6
2 3
4 11
10 13
14 10
7 6
8 7
16 15
7 15
5 8
12 2
12 1
6 7
6 11
13 14
18 13
15 3
7 9
13 3
18 13
11 4
4 10
14 3
6 13
12 14
12 14
3 9
5 2

output:

0 0 2 2 0 2 2 0 2 2 2 0 2 2 0 0 0 2 

result:

ok answer = 38

Test #22:

score: 0
Accepted
time: 40ms
memory: 3400kb

input:

18 30 66
3 17
2 6
13 17
11 16
17 13
16 10
10 11
16 15
6 3
14 2
3 8
5 9
7 11
15 7
17 15
14 18
1 3
10 1
4 15
5 17
11 5
18 13
13 10
11 17
16 17
5 7
13 7
10 5
10 16
18 8

output:

1 0 1 0 8 0 8 0 0 8 8 0 8 0 8 8 8 0 

result:

ok answer = 147

Test #23:

score: 0
Accepted
time: 44ms
memory: 3404kb

input:

18 100000 55
8 2
4 15
6 2
4 3
10 15
18 9
10 12
1 6
17 3
18 13
11 5
3 4
17 2
10 5
15 2
15 12
14 9
11 3
10 6
5 7
5 16
10 14
2 12
12 11
4 8
12 5
2 9
11 18
15 14
13 7
18 5
7 16
7 12
17 10
18 14
8 5
9 5
2 13
1 9
14 18
4 2
13 5
7 11
14 15
5 12
2 1
6 13
13 3
12 2
9 1
4 8
17 13
2 17
15 18
4 5
18 10
12 16
14...

output:

4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 

result:

ok answer = 300000

Test #24:

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

input:

18 100000 33
4 14
11 2
17 6
10 12
1 12
2 15
17 5
14 18
17 3
10 13
2 8
12 6
12 5
16 15
3 9
5 12
5 9
3 4
9 18
15 1
4 6
8 15
3 11
5 1
11 3
9 3
14 7
3 1
13 16
17 18
18 7
10 1
1 7
11 3
10 16
6 1
7 5
18 2
9 16
12 2
9 14
8 18
7 13
13 8
4 15
16 13
18 11
13 5
2 4
3 12
4 5
2 9
10 14
11 13
13 11
16 1
5 3
15 13...

output:

2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 1 2 2 

result:

ok answer = 169113

Test #25:

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

input:

18 100000 79
15 10
2 9
2 1
16 5
17 4
14 16
17 3
16 6
16 1
3 7
17 14
7 15
12 6
12 7
6 15
16 1
11 14
2 6
16 11
14 11
6 3
1 12
5 1
13 9
16 10
15 4
18 11
14 10
16 10
9 16
3 2
10 14
5 6
15 1
17 7
11 7
1 15
16 6
3 8
6 14
16 7
8 17
3 9
3 16
3 6
18 13
8 9
12 14
7 6
14 7
4 14
15 8
2 18
10 6
8 16
17 18
7 1
7 ...

output:

5 4 4 4 4 4 5 4 4 5 4 4 5 4 4 5 5 5 

result:

ok answer = 414155

Test #26:

score: 0
Accepted
time: 44ms
memory: 3404kb

input:

18 100000 57
8 7
8 16
3 12
2 16
16 14
7 18
16 17
17 9
15 18
14 16
15 2
1 8
14 6
7 18
11 4
11 8
1 3
15 16
14 13
15 4
6 14
4 12
17 16
5 4
17 15
5 16
17 16
14 5
16 3
13 1
15 5
1 10
12 4
13 18
13 14
5 12
5 16
17 12
14 1
4 15
8 16
4 13
17 2
15 3
10 16
17 3
6 5
12 9
3 9
14 11
13 15
1 2
3 16
1 17
13 15
14 ...

output:

3 3 3 3 3 4 3 3 3 3 3 3 4 3 3 3 4 3 

result:

ok answer = 302082

Test #27:

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

input:

18 100000 70
2 3
17 5
6 7
12 7
1 18
16 15
1 15
13 15
7 10
14 7
13 1
13 7
3 10
16 10
6 16
3 5
7 1
16 12
18 17
4 3
15 17
5 6
1 3
12 7
1 13
13 15
17 14
13 10
6 12
14 16
17 2
4 17
13 12
4 17
15 10
9 11
15 18
10 3
12 15
6 9
3 10
9 5
10 1
4 12
11 10
18 1
9 7
2 10
4 12
4 1
11 1
16 11
17 15
2 14
13 11
12 7
...

output:

4 4 4 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 

result:

ok answer = 378879

Test #28:

score: 0
Accepted
time: 33ms
memory: 3412kb

input:

18 1950 23
1 2
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
2 1
1 2
2 1
1 2
2 1
2 1
1 2
1 2
1 2
2 1
1 2
1 2
1 2
2 1
2 1
2 1
1 2
2 1
1 2
1 2
1 2
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
1 2
1 2
1 2
2 1
1 2
2 1
1 2
2 1
1 2
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2...

output:

2 2 2 2 2 2 2 2 2 2 0 2 1 0 0 0 0 0 

result:

ok answer = 2851

Test #29:

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

input:

18 1950 58
2 1
1 2
2 1
2 1
1 2
2 1
2 1
1 2
2 1
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
2 1
1 2
1 2
2 1
2 1
1 2
2 1
1 2
1 2
1 2
2 1
2 1
1 2
2 1
1 2
2 1
1 2
1 2
2 1
2 1
2 1
1 2
1 2
1 2
2 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
1 2
1 2
1 2
2 1
2 1
1...

output:

4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 0 0 0 

result:

ok answer = 7479

Test #30:

score: 0
Accepted
time: 38ms
memory: 3452kb

input:

18 1950 66
1 2
2 1
1 2
1 2
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
1 2
1 2
1 2
2 1
1 2
2 1
2 1
1 2
1 2
1 2
2 1
1 2
2 1
1 2
2 1
1 2
1 2
2 1
1 2
2 1
2 1
2 1
1 2
1 2
2 1
2 1
1 2
1 2
1 2
2 1
2 1
1 2
2 1
2 1
2 1
1 2
1 2
2 1
1 2
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
1 2
1 2
2 1
2 1
1 2
2 1
2 1
1 2
1 2
1...

output:

5 5 5 5 5 4 4 5 4 4 4 4 4 4 4 0 0 0 

result:

ok answer = 8450

Test #31:

score: 0
Accepted
time: 39ms
memory: 3448kb

input:

18 1950 92
1 2
1 2
2 1
2 1
1 2
1 2
2 1
2 1
1 2
2 1
1 2
1 2
2 1
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
1 2
2 1
2 1
1 2
2 1
2 1
1 2
1 2
2 1
1 2
1 2
1 2
2 1
2 1
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
1 2
1 2
2 1
2 1
1 2
1 2
1 2
1 2
1 2
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
1 2
2 1
2...

output:

7 7 6 6 6 6 6 6 6 6 6 6 6 6 6 0 0 0 

result:

ok answer = 11900

Test #32:

score: 0
Accepted
time: 42ms
memory: 3468kb

input:

18 1950 87
1 2
1 2
1 2
2 1
2 1
1 2
1 2
2 1
2 1
1 2
2 1
2 1
2 1
1 2
1 2
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
2 1
2 1
2 1
1 2
1 2
2 1
1 2
1 2
1 2
2 1
1 2
1 2
2 1
2 1
2 1
1 2
2 1
1 2
2 1
1 2
1 2
2 1
1 2
2 1
1 2
2 1
2 1
1 2
1 2
1 2
1 2
1 2
2 1
1 2
2 1
1 2
1 2
1 2
2 1
2 1
2 1
2 1
1 2
1 2
2 1
1 2
1 2
2...

output:

6 6 6 6 6 6 6 6 6 6 6 6 6 6 3 0 0 0 

result:

ok answer = 11247

Test #33:

score: 0
Accepted
time: 39ms
memory: 3588kb

input:

18 1950 70
2 1
2 1
1 2
2 1
1 2
2 1
2 1
1 2
1 2
2 1
1 2
2 1
2 1
2 1
1 2
1 2
1 2
1 2
1 2
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 2
1 2
2 1
2 1
1 2
1 2
1 2
1 2
2 1
1 2
1 2
2 1
2 1
1 2
2 1
1 2
1 2
1 2
2 1
1 2
2 1
1 2
1 2
1 2
2 1
1...

output:

5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 0 0 0 

result:

ok answer = 9000

Test #34:

score: 0
Accepted
time: 40ms
memory: 3448kb

input:

18 1950 68
2 1
1 2
2 1
2 1
1 2
1 2
1 2
2 1
2 1
2 1
2 1
2 1
2 1
1 2
1 2
2 1
2 1
1 2
2 1
2 1
1 2
2 1
1 2
1 2
1 2
1 2
1 2
2 1
1 2
2 1
1 2
1 2
2 1
2 1
1 2
1 2
1 2
1 2
2 1
2 1
2 1
1 2
1 2
2 1
1 2
1 2
2 1
1 2
2 1
1 2
2 1
1 2
2 1
1 2
2 1
2 1
2 1
2 1
2 1
2 1
1 2
1 2
1 2
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
1 2
2...

output:

5 5 5 5 5 5 5 4 5 4 4 4 4 4 4 0 0 0 

result:

ok answer = 8702

Test #35:

score: 0
Accepted
time: 45ms
memory: 3452kb

input:

18 1950 100
1 2
2 1
2 1
2 1
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
2 1
1 2
1 2
2 1
2 1
2 1
2 1
1 2
2 1
2 1
2 1
2 1
1 2
1 2
1 2
2 1
2 1
1 2
1 2
2 1
2 1
1 2
2 1
1 2
1 2
2 1
1 2
2 1
2 1
2 1
1 2
1 2
1 2
2 1
1 2
1 2
1 2
2 1
1 2
2 1
2 1
1 2
1 2
2 1
2 1
1 2
1 2
1 2
1 2
1 2
2 1
1 2
2 1
1 2
1 2
2 1
1 2
1 2
2 1
2 1
...

output:

7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 0 0 0 

result:

ok answer = 12900

Test #36:

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

input:

1 0 0

output:

0 

result:

ok answer = 0

Test #37:

score: 0
Accepted
time: 34ms
memory: 3456kb

input:

18 1025 33
2 7
4 1
5 9
4 10
8 10
2 3
4 7
1 9
5 9
9 5
7 1
8 7
2 6
9 5
7 2
7 6
3 10
8 5
5 4
7 8
4 3
9 5
3 1
3 8
5 2
3 9
4 5
4 10
10 7
9 10
3 10
9 7
1 5
6 7
3 4
1 10
10 3
4 3
8 5
7 4
5 7
10 7
1 8
1 8
1 4
5 4
9 6
7 8
4 9
6 5
7 2
8 4
7 9
9 1
7 2
5 2
1 8
10 9
2 5
9 1
3 1
10 6
3 2
5 8
6 9
10 2
1 2
9 1
2 10...

output:

3 3 3 3 3 3 3 3 3 3 2 1 0 0 0 0 0 0 

result:

ok answer = 2855

Test #38:

score: 0
Accepted
time: 45ms
memory: 3352kb

input:

18 1950 100
14 16
4 11
11 9
1 3
18 13
12 3
8 6
7 14
18 6
1 4
7 3
9 16
4 15
15 6
6 11
1 16
7 18
1 14
3 9
11 7
11 3
11 7
8 1
13 3
14 3
12 13
15 2
9 11
9 4
8 6
8 6
1 4
1 12
18 8
11 3
3 13
2 11
18 4
9 11
3 1
8 16
2 18
11 1
12 15
15 11
11 4
9 11
6 12
12 15
7 6
9 4
4 9
13 4
4 9
6 11
4 9
13 4
4 9
9 3
7 1
1...

output:

7 6 7 7 0 7 6 6 7 0 7 7 7 6 7 6 0 7 

result:

ok answer = 12900

Test #39:

score: 0
Accepted
time: 34ms
memory: 3456kb

input:

18 1025 33
10 13
9 11
13 3
16 10
10 11
2 18
18 9
9 13
15 16
13 10
15 16
6 10
9 11
11 6
10 9
3 7
13 15
10 16
7 2
7 11
7 9
6 3
2 16
6 3
16 6
10 11
6 18
9 11
3 18
7 18
9 11
11 7
8 11
18 13
3 13
16 18
7 3
11 9
3 16
10 8
18 7
11 7
18 7
11 18
13 11
11 9
10 16
13 15
9 3
11 16
18 8
18 10
15 9
11 7
16 9
15 7...

output:

0 1 3 0 0 3 3 2 3 3 3 0 3 0 3 3 0 3 

result:

ok answer = 2855

Test #40:

score: 0
Accepted
time: 36ms
memory: 3404kb

input:

18 1640 48
5 14
10 6
12 1
3 7
11 3
1 14
7 10
9 14
12 4
13 3
6 10
12 8
4 11
8 3
11 9
8 12
8 5
14 6
5 13
8 10
6 10
12 9
10 14
9 4
1 7
9 12
7 6
6 8
7 5
10 2
13 7
13 6
8 9
9 13
7 3
8 1
1 13
9 13
6 3
1 9
3 14
8 6
10 4
10 2
9 13
1 11
10 1
14 10
3 11
11 6
13 1
6 7
7 11
1 14
5 2
8 13
13 14
1 11
9 11
2 11
1 ...

output:

3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 1 2 

result:

ok answer = 4394

Test #41:

score: 0
Accepted
time: 35ms
memory: 3412kb

input:

18 1640 48
14 5
6 14
4 2
1 2
8 17
16 9
13 3
7 1
11 13
1 7
3 16
2 3
2 15
2 1
18 10
18 14
4 16
5 10
9 14
3 2
7 6
16 18
14 16
5 10
13 2
13 9
14 8
11 3
8 12
5 9
7 6
8 3
8 12
10 1
5 6
3 5
14 5
2 7
16 2
13 6
5 9
3 12
11 13
4 1
17 8
4 17
10 2
7 5
5 13
17 4
9 4
8 6
5 2
14 6
14 9
4 1
12 1
5 7
18 8
8 4
8 5
2 ...

output:

3 3 3 3 3 3 3 3 3 3 2 3 2 3 1 3 1 3 

result:

ok answer = 4392

Test #42:

score: 0
Accepted
time: 31ms
memory: 3408kb

input:

18 1640 46
14 15
4 11
12 18
17 7
17 13
10 17
8 15
17 11
17 18
4 16
3 10
1 9
18 6
3 4
11 2
6 7
14 1
9 15
13 12
3 11
3 7
7 14
14 10
10 3
12 8
18 9
17 18
10 5
4 11
6 12
18 13
3 16
5 11
3 17
1 12
18 16
14 8
3 17
14 13
2 10
18 2
5 4
3 6
8 12
15 9
2 18
6 16
4 18
13 4
3 8
11 7
14 8
17 18
5 12
4 12
11 12
14...

output:

1 3 3 3 3 3 3 1 1 3 3 3 3 3 1 3 3 3 

result:

ok answer = 4240

Test #43:

score: 0
Accepted
time: 36ms
memory: 3464kb

input:

18 1640 45
12 8
4 18
18 14
6 3
11 6
10 15
7 14
14 17
1 3
10 18
18 4
12 9
14 10
1 6
18 10
18 11
17 8
11 18
11 9
7 5
18 14
11 14
14 11
3 14
4 15
10 6
12 9
14 1
6 8
11 17
8 7
12 7
17 7
11 4
3 5
17 9
5 12
15 9
1 14
15 2
3 13
1 18
5 6
9 1
14 8
12 11
1 4
4 7
2 10
12 11
9 7
6 14
15 10
17 5
10 6
10 6
6 12
1...

output:

3 1 1 3 3 3 3 3 3 3 3 3 1 3 0 3 3 3 

result:

ok answer = 4149

Test #44:

score: 0
Accepted
time: 35ms
memory: 3452kb

input:

18 1640 44
2 7
7 6
4 11
7 2
18 8
11 3
13 2
6 3
17 4
18 2
4 17
3 12
10 2
10 2
7 8
6 17
18 4
7 8
3 11
11 17
8 2
9 18
7 15
6 3
17 1
8 2
9 1
9 11
7 16
7 3
8 9
10 3
1 15
3 17
1 7
14 1
12 8
3 7
15 2
11 10
3 14
10 15
18 16
17 11
6 17
9 14
12 14
12 14
15 5
13 14
13 14
15 5
3 8
6 5
16 6
8 4
5 1
5 6
9 15
16 3...

output:

0 3 3 3 3 3 3 3 3 3 3 0 1 1 3 3 3 3 

result:

ok answer = 4052

Test #45:

score: 0
Accepted
time: 35ms
memory: 3468kb

input:

18 1640 43
17 13
15 14
14 16
14 12
7 17
14 5
18 8
18 13
1 16
5 17
11 16
6 11
7 12
12 16
7 15
12 6
15 7
8 11
15 17
15 12
4 13
6 17
16 12
1 13
5 4
16 5
16 7
16 2
15 10
10 12
15 9
10 2
1 10
14 16
10 16
15 2
14 6
18 11
1 11
11 12
3 13
5 12
10 11
7 5
1 13
17 4
6 11
6 7
10 5
4 2
1 8
5 4
17 4
11 16
17 9
14...

output:

3 0 3 3 3 0 3 1 3 3 0 3 3 3 3 3 3 3 

result:

ok answer = 3977

Test #46:

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

input:

18 1640 49
7 6
9 4
17 5
7 13
15 4
1 13
4 18
11 6
11 13
17 11
13 6
7 6
8 14
17 15
11 14
11 3
3 18
18 2
10 16
17 9
10 1
5 17
10 9
8 4
15 7
10 2
7 2
17 4
7 15
4 17
4 16
15 5
17 5
5 4
12 7
13 11
18 10
8 14
16 18
14 18
6 12
15 9
10 4
2 10
18 16
6 2
11 14
5 15
13 9
16 2
13 2
12 10
11 4
18 1
6 16
16 10
12 ...

output:

3 3 1 3 3 3 3 2 3 3 2 3 3 2 3 3 3 3 

result:

ok answer = 4484

Test #47:

score: 0
Accepted
time: 36ms
memory: 3404kb

input:

18 1640 50
3 17
6 12
4 13
4 14
17 12
5 15
9 11
8 5
2 13
10 14
2 10
11 16
1 3
4 18
9 11
4 7
7 17
2 14
7 18
9 13
9 18
7 9
1 13
6 9
13 11
1 14
13 3
3 15
4 3
8 13
8 9
2 18
6 1
15 6
4 15
12 8
12 6
13 8
7 8
12 17
2 10
8 3
13 17
3 11
11 12
3 4
3 7
18 16
18 7
17 13
2 16
4 15
13 5
1 10
4 16
15 6
3 9
9 11
7 1...

output:

2 2 3 3 3 3 3 3 3 2 3 3 3 2 3 3 3 3 

result:

ok answer = 4580

Test #48:

score: 0
Accepted
time: 36ms
memory: 3404kb

input:

18 1640 51
2 15
13 18
4 3
7 11
10 7
18 4
1 16
6 14
12 8
1 14
9 5
18 8
11 2
5 6
6 5
8 13
13 18
18 8
13 9
7 2
6 11
8 13
17 18
6 13
7 15
3 8
10 7
15 8
14 5
8 13
6 16
3 8
2 18
2 10
17 16
14 7
7 8
11 14
14 17
13 5
7 17
7 14
18 3
11 14
11 6
18 16
5 18
1 16
5 4
14 4
3 5
12 13
14 15
6 14
13 7
6 13
7 4
8 2
2...

output:

3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 2 2 3 

result:

ok answer = 4646

Test #49:

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

input:

18 1640 0
8 9
13 15
5 7
3 16
11 17
14 2
12 16
1 2
10 9
2 11
4 14
12 16
1 14
17 2
7 14
3 18
8 11
17 2
6 12
1 5
8 3
8 16
16 3
13 9
5 4
11 6
2 11
12 4
9 5
5 8
2 5
6 12
4 17
5 18
9 14
4 11
12 14
14 5
8 15
9 10
3 10
3 5
9 10
14 16
16 5
8 14
13 10
18 16
2 17
5 2
13 6
3 2
18 10
18 11
16 12
7 6
15 11
13 9
1...

output:

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

result:

ok answer = 0

Test #50:

score: 0
Accepted
time: 44ms
memory: 3412kb

input:

18 1640 100
5 16
17 7
17 2
2 16
14 1
15 14
2 17
9 7
16 13
1 2
2 4
14 2
8 1
6 2
14 15
18 12
3 6
7 13
6 11
8 4
1 2
6 10
18 16
15 2
16 6
3 8
10 3
8 6
12 3
8 2
9 16
15 9
14 8
2 17
14 9
4 14
2 13
17 7
10 5
16 17
17 1
4 2
7 14
15 13
13 18
11 13
4 8
5 3
18 9
11 15
1 4
17 9
16 6
10 5
10 3
15 7
7 13
18 5
9 1...

output:

7 7 1 7 0 7 7 7 7 1 7 0 7 7 7 7 7 7 

result:

ok answer = 9253