QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#354912#7181. Graph Cutsucup-team1617#WA 1584ms36788kbC++235.0kb2024-03-16 08:06:452024-03-16 08:06:45

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 6ms
memory: 20420kb

input:

4 5
1 2
1 3
1 4
2 3
2 4
10
+ 1
+ 2
?
?
?
?
?
- 2
?
?

output:

4
5
2
3
0
1
0

result:

ok q=10

Test #2:

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

input:

0 0
0

output:


result:

ok q=0

Test #3:

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

input:

0 0
1
?

output:

0

result:

ok q=1

Test #4:

score: 0
Accepted
time: 13ms
memory: 20928kb

input:

1000 2000
1 50
1 88
331 1
1 352
1 497
2 32
2 282
550 2
989 2
334 3
3 665
4 38
4 69
4 343
4 451
589 4
917 4
89 5
5 162
675 5
681 6
7 22
127 7
7 592
7 672
787 7
8 310
107 9
9 137
184 9
9 244
378 9
446 9
9 658
883 9
65 10
75 10
414 10
10 468
686 10
245 11
269 11
11 386
403 11
493 11
394 12
493 12
565 1...

output:

207
1990
275
1284
567
1285
854
1928
1769
1850
1147
1917
1287
1043
497
718
1741
528
1182
615
89
1225
374
727
573
1439
340
1696
1588
1801
461
895
896
743
754
846
435
1725
1560
1561
1702
509
1083
1857
1877
1390
1556
1009
1228
1194
1212
625
255
684
1956
396
1267
1796
805
1278
476
1076
1993
479
839
125
4...

result:

ok q=100000

Test #5:

score: 0
Accepted
time: 1573ms
memory: 36552kb

input:

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

output:

77103

result:

ok q=100000

Test #6:

score: 0
Accepted
time: 1421ms
memory: 36644kb

input:

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

output:

29181
19080
62165
41027
99115
62002
98646
95572
87435
99636
97728
63333
53602
84105
46192
32519
76020
64169
93794
22652
66784
66010
47024
28804
28799
93464
58063
1334
49276
17871
17868
98242
42384
20677
99542
98688
98682
63635
47999
16244
16239
32885
62821
22259
3100
72416
99404
41710
76245
99488
61...

result:

ok q=100000

Test #7:

score: 0
Accepted
time: 1289ms
memory: 36764kb

input:

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

output:

64435
66011
891
52095
52094
90090
90089
65745
23042
99678
91553
37553
66528
66527
48000
93353
54530
41027
74926
74917
74909
74904
74894
74889
94325
94324
94323
98456
98455
3976
83384
40683
28428
58352
29549
29544
11264
11259
11258
58639
58638
92300
49277
62279
62278
95025
26145
26144
9581
9580
3540
...

result:

ok q=100000

Test #8:

score: 0
Accepted
time: 1115ms
memory: 36624kb

input:

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

output:

0
36895
37553
99671
99670
97196
66785
77525
9153
9152
9150
90365
90364
90363
88205
88204
88203
88201
88199
88197
83176
83127
83106
83091
94144
87591
87590
87589
87587
13361
14190
14188
14187
14186
46022
70035
70034
89251
86344
91806
91805
91804
91803
98444
89375
97391
97342
96912
12940
94325
94322
5...

result:

ok q=100000

Test #9:

score: 0
Accepted
time: 869ms
memory: 36788kb

input:

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

output:

0
0
0
0
0
0
0
0
33251
33250
33249
33248
33247
96358
94762
94663
94563
94462
94257
65489
65488
65485
65484
65483
87278
87277
87276
98303
98302
98301
86151
86150
86148
86145
99186
38256
38254
38253
38251
38250
38249
38248
96906
99627
99617
99594
99581
99567
99536
60621
90228
72186
72185
94010
94009
43...

result:

ok q=100000

Test #10:

score: 0
Accepted
time: 548ms
memory: 36548kb

input:

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

output:

0
0
0
0
62553
62552
62550
62548
62547
62545
62543
62542
99660
99638
99629
99619
99608
99596
40678
40334
66785
66784
66783
66781
66780
66777
24215
24214
24211
24210
24209
24206
24205
24202
24201
24197
24196
24195
24193
84975
84974
84972
84971
84970
84969
84967
84966
84965
84964
84961
84960
84959
8495...

result:

ok q=100000

Test #11:

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

input:

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

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 q=100000

Test #12:

score: 0
Accepted
time: 1564ms
memory: 36700kb

input:

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

output:

63093

result:

ok q=100000

Test #13:

score: 0
Accepted
time: 1415ms
memory: 36644kb

input:

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

output:

98541
98539
80371
80369
80368
91421
98735
72420
88802
88798
39995
19477
81914
81913
64965
73115
79980
65750
99244
28417
88949
442
48959
78152
96600
60059
80959
35060
36135
99427
56610
32883
95215
95214
2651
33241
90500
96520
99663
1775
31040
50537
84105
56902
86961
68555
98406
57195
2220
99668
53318...

result:

ok q=100000

Test #14:

score: 0
Accepted
time: 1280ms
memory: 36632kb

input:

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

output:

93685
76675
24989
88204
75591
75587
41024
62824
62823
56021
56017
89528
89521
89516
89507
70519
70518
61731
97196
97189
97184
93353
10001
10003
98978
67295
67294
50539
73802
74256
96976
38256
72185
65490
74704
74703
63634
63633
87591
35057
35056
11271
86961
93350
93347
88649
88645
97851
81726
92537
...

result:

ok q=100000

Test #15:

score: 0
Accepted
time: 1124ms
memory: 36600kb

input:

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

output:

69053
69052
86148
2658
79377
79376
79375
88800
88798
88796
88795
85650
98192
33614
67803
63093
63092
63091
39303
39295
94527
94525
94523
94517
94514
94513
94510
94503
67800
99465
99399
99375
91680
91679
67550
67549
67548
38255
38254
38244
38241
38238
59492
59491
74030
74029
96740
85313
85312
85146
8...

result:

ok q=100000

Test #16:

score: 0
Accepted
time: 877ms
memory: 36524kb

input:

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

output:

10428
52710
50849
50845
50841
50837
50834
78565
58065
58063
58062
58059
58058
18275
18273
36487
32150
32142
10846
97597
97596
97593
28425
28423
13775
13766
13762
13761
13757
13752
13746
13743
95308
95305
60899
60896
60892
98085
98083
6150
12944
92777
92768
15832
15828
76675
76672
76668
76666
76664
7...

result:

ok q=100000

Test #17:

score: 0
Accepted
time: 544ms
memory: 36704kb

input:

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

output:

96594
77315
77313
77310
97722
97719
97717
17464
17459
78152
78150
78149
79178
79176
79173
79172
79171
79169
79167
79165
79163
35777
40337
40331
40323
40322
40319
40302
40298
40293
40285
40284
40278
40275
40271
40269
40267
40264
40263
80571
80569
80566
76676
76674
76671
76670
76669
76667
76665
76663
...

result:

ok q=100000

Test #18:

score: 0
Accepted
time: 69ms
memory: 36540kb

input:

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

output:

81915
81913
81912
81910
81909
81904
81903
81901
81899
81896
81893
81890
81889
81888
81887
81884
81883
81882
81881
81878
81875
81872
81866
81865
81862
81858
81857
81856
81854
81853
81850
81848
81844
81843
81842
81840
81839
81837
81835
81834
81833
81830
81828
81825
81824
81823
81822
81821
81819
81818
...

result:

ok q=100000

Test #19:

score: 0
Accepted
time: 1584ms
memory: 36700kb

input:

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

output:

99319

result:

ok q=100000

Test #20:

score: 0
Accepted
time: 1448ms
memory: 36540kb

input:

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

output:

48960
48959
26503
98735
96278
18678
18677
64436
28805
98600
74030
74029
66528
99615
83203
87900
87899
40685
95403
99666
99403
17466
23436
19881
26145
56316
36491
36490
99680
85653
55722
33251
87120
75589
36485
98013
98012
23826
98406
92541
97052
97046
97041
97040
81152
81153
81150
81149
81148
99458
...

result:

ok q=100000

Test #21:

score: 0
Accepted
time: 1314ms
memory: 36688kb

input:

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

output:

42728
89951
69546
64965
78566
97196
99680
14603
14602
14599
71478
77736
99246
31771
40685
36491
92658
89811
92300
92299
18677
18674
75810
99530
67803
70759
95495
71001
98600
98599
9579
9578
79781
81726
91806
91805
96195
98808
98085
98978
8302
94116
76676
4849
88801
63366
93574
84973
84972
85316
8531...

result:

ok q=100000

Test #22:

score: 0
Accepted
time: 1115ms
memory: 36624kb

input:

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

output:

0
0
97196
97195
97194
15426
15425
15424
78771
60060
98691
98690
99303
99302
99301
83210
94631
27671
89528
90228
90227
90226
90224
90223
90221
90220
90219
90218
53016
53015
53014
79781
91290
96521
96520
97470
99626
99625
99624
99622
99275
99051
99050
36135
36134
36133
29930
59495
90636
90635
84975
96...

result:

ok q=100000

Test #23:

score: 0
Accepted
time: 892ms
memory: 36764kb

input:

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

output:

81345
66011
66010
66009
66008
66007
88506
88505
88504
88503
50206
47355
47354
47353
81153
81152
81151
81150
19481
19480
16653
16652
16651
16650
6585
6584
6583
6582
6581
6580
89811
89810
89809
89808
89807
89806
89805
92660
88356
88355
88354
72885
72884
72883
72882
72881
38606
69300
69299
99356
99355
...

result:

ok q=100000

Test #24:

score: 0
Accepted
time: 530ms
memory: 36700kb

input:

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

output:

0
0
0
0
94325
94324
94323
94322
94321
94320
59495
59494
59493
59492
70035
70034
70033
70032
70031
70030
70029
70028
70027
70026
70025
70024
70023
61731
61730
99428
91553
91552
56610
56609
56608
51165
97911
97910
97909
97908
97907
40685
92541
92540
90228
56316
56315
56314
98456
98455
98454
98453
9845...

result:

ok q=100000

Test #25:

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

input:

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

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 q=100000

Test #26:

score: 0
Accepted
time: 1564ms
memory: 36676kb

input:

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

output:

53093

result:

ok q=100000

Test #27:

score: -100
Wrong Answer
time: 1433ms
memory: 36632kb

input:

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

output:

79123
32130
32129
2221
61085
68672
99865
56986
79116
89160
10436
10432
96685
99933
96165
5293
39348
70396
47750
99744
90556
41427
11706
56110
98288
22285
99564
87614
100000
9576
9566
79933
79932
79931
89858
89855
98778
7022
78506
87616
87612
76167
31825
88541
88540
21495
90145
32926
96767
84626
9599...

result:

wrong answer Edge exists, but not found