QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#443581#8584. 바이러스GuanYunchang5 331ms9864kbC++201.9kb2024-06-15 16:00:362024-06-15 16:00:36

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 3580kb

input:

8 5
0 1
1 2
2 3
3 4
4 5
5 6
6 7
2 2
5 0
7 0
1 1
4 1
40 5 5 16 32 8 1 10

output:

0
24
-1
5
16

result:

ok 5 lines

Test #2:

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

input:

1 2
0 0
0 0
1000000000

output:

0
1000000000

result:

ok 2 lines

Test #3:

score: 5
Accepted
time: 0ms
memory: 3832kb

input:

1 1
0 0
1

output:

0

result:

ok single line: '0'

Test #4:

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

input:

5 5
0 1
1 2
2 3
3 4
4 4
3 4
3 4
4 4
3 3
205776802 419505279 604355565 320588676 267287300

output:

0
205776802
205776802
205776802
205776802

result:

ok 5 lines

Test #5:

score: 5
Accepted
time: 0ms
memory: 3644kb

input:

5 5
0 1
1 2
2 3
3 4
0 1
2 4
3 2
2 2
0 3
798595430 17544794 263282020 749935522 265537216

output:

0
17544794
17544794
17544794
17544794

result:

ok 5 lines

Test #6:

score: 5
Accepted
time: 0ms
memory: 3652kb

input:

5 5
0 1
1 2
2 3
3 4
4 0
3 0
0 0
1 1
1 0
805814316 68727170 931548944 955566578 268585692

output:

0
-1
-1
-1
-1

result:

ok 5 lines

Test #7:

score: 5
Accepted
time: 0ms
memory: 3656kb

input:

5 5
0 1
1 2
2 3
3 4
3 4
0 4
2 4
2 4
2 4
140258399 508694682 846494800 923720900 238592045

output:

0
140258399
140258399
140258399
140258399

result:

ok 5 lines

Test #8:

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

input:

10 10
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
8 7
3 7
9 8
0 5
5 7
4 3
2 9
6 9
7 8
4 8
998183090 584072254 887174893 11448861 742483923 59447072 545713676 980826811 811598242 35544321

output:

0
11448861
11448861
11448861
11448861
11448861
11448861
11448861
11448861
11448861

result:

ok 10 lines

Test #9:

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

input:

10 10
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
2 5
5 4
9 5
2 9
5 2
6 4
2 4
8 4
9 7
2 0
911698130 382043019 90722009 440968421 571375991 137522383 377189267 211855539 341720684 687999451

output:

0
90722009
137522383
90722009
137522383
90722009
90722009
137522383
90722009
90722009

result:

ok 10 lines

Test #10:

score: 5
Accepted
time: 0ms
memory: 3852kb

input:

10 10
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
3 3
2 5
0 4
3 2
5 1
1 0
4 2
8 0
3 2
3 0
892608355 903586083 572266475 47500884 6301829 729660024 455211808 942317353 131889193 801254776

output:

0
6301829
6301829
6301829
6301829
903586083
6301829
-1
6301829
47500884

result:

ok 10 lines

Test #11:

score: 5
Accepted
time: 0ms
memory: 3680kb

input:

10 10
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
0 9
9 9
4 9
0 9
7 9
8 9
0 9
6 9
5 9
4 9
95389682 395000358 484533614 652845161 327306317 799690376 871884048 751786316 693371321 784309957

output:

0
95389682
95389682
95389682
95389682
95389682
95389682
95389682
95389682
95389682

result:

ok 10 lines

Test #12:

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

input:

20 20
0 1
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
2 12
0 12
5 17
7 14
6 16
1 19
13 18
6 14
4 9
0 18
18 18
6 11
0 13
15 17
1 8
6 18
9 9
13 16
6 19
2 15
436523225 735146636 641656461 569341995 381628222 450451359 605334108 99712125 988489106 717299297...

output:

0
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125
99712125

result:

ok 20 lines

Test #13:

score: 5
Accepted
time: 1ms
memory: 3652kb

input:

20 20
0 1
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
13 3
6 4
16 1
19 19
19 17
5 2
5 7
12 7
6 18
12 11
18 11
11 5
13 13
15 19
19 3
9 7
16 7
16 6
5 7
8 9
999021218 83246177 270836731 525612430 672541663 476653247 839288054 764153704 941216586 648134044 ...

output:

0
348015639
499890278
77178908
77178908
553832155
160425085
77178908
77178908
77178908
77178908
77178908
77178908
77178908
300536180
77178908
77178908
77178908
160425085
77178908

result:

ok 20 lines

Test #14:

score: 5
Accepted
time: 1ms
memory: 3888kb

input:

20 20
0 1
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
12 8
12 4
19 3
8 0
12 0
16 0
4 0
12 1
3 3
9 6
11 5
6 7
14 9
8 5
15 2
8 5
8 2
0 2
18 3
16 7
346014551 491695164 57622712 97722771 993912839 996909253 733512353 277580504 195751201 438876633 523544328 ...

output:

0
195751201
519350473
195751201
377943706
519350473
993912839
377943706
253373913
195751201
195751201
195751201
195751201
195751201
519350473
195751201
195751201
253373913
519350473
377943706

result:

ok 20 lines

Test #15:

score: 5
Accepted
time: 1ms
memory: 3636kb

input:

20 20
0 1
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
7 19
5 19
8 19
17 19
14 19
19 19
15 19
14 19
12 19
15 19
9 19
1 19
0 19
2 19
8 19
8 19
4 19
8 19
13 19
1 19
69882800 452312168 666117339 829711627 782632700 231822906 990022913 818955019 160583703 53...

output:

0
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683
2957683

result:

ok 20 lines

Test #16:

score: 5
Accepted
time: 260ms
memory: 8656kb

input:

500 500
0 1
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
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

0
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
15461593
5660055
9594340
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
5660055
18867951
5660055
...

result:

ok 500 lines

Test #17:

score: 5
Accepted
time: 221ms
memory: 8832kb

input:

500 500
0 1
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
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

0
1835541
39136776
9642798
1835541
1835541
3122805
3122805
1835541
1835541
1835541
1835541
1835541
1835541
1835541
75659436
1835541
3122805
1835541
1835541
1835541
1835541
3122805
1835541
1835541
1835541
3122805
3122805
3122805
3122805
1835541
3122805
1835541
1835541
3122805
1835541
1835541
1835541
...

result:

ok 500 lines

Test #18:

score: 5
Accepted
time: 197ms
memory: 8816kb

input:

500 500
0 1
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
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

0
15059089
6799303
6799303
6799303
7283744
6799303
11520777
6799303
6799303
40534885
14863038
6799303
7283744
6799303
11520777
7840730
6799303
7283744
6799303
51471677
11520777
7283744
40534885
7840730
7283744
6799303
6799303
7283744
6799303
6799303
40515088
40534885
6799303
6799303
40515088
1486303...

result:

ok 500 lines

Test #19:

score: 5
Accepted
time: 283ms
memory: 9864kb

input:

500 500
0 1
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
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

0
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
296569
2965...

result:

ok 500 lines

Subtask #2:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #20:

score: 0
Runtime Error

input:

5000 5000
0 1
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
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

Unauthorized output

result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 5
Accepted
time: 1ms
memory: 3824kb

input:

8 5
0 1
1 2
2 3
3 4
4 5
3 6
3 7
2 2
5 0
7 0
1 1
4 1
40 5 5 16 32 8 1 10

output:

0
24
10
5
16

result:

ok 5 lines

Test #35:

score: 5
Accepted
time: 1ms
memory: 3676kb

input:

10 10
9 3
0 6
1 8
5 1
3 2
8 7
0 4
6 5
0 9
9 0
7 2
1 0
8 1
6 3
1 2
4 6
7 2
5 1
5 4
10 12 5 9 8 21 20 6 13 5

output:

0
11
17
11
5
11
5
11
17
5

result:

ok 10 lines

Test #36:

score: 5
Accepted
time: 0ms
memory: 3708kb

input:

20 20
16 11
13 10
17 6
13 18
13 16
13 0
2 5
14 7
5 17
15 1
18 19
7 15
6 4
13 2
1 8
0 14
13 12
13 9
9 3
10 9
5 16
8 18
0 19
17 16
7 11
2 7
15 13
18 18
19 11
2 18
16 7
11 17
16 19
14 15
5 15
13 19
5 8
7 15
17 15
201842345 959136634 799276472 790823713 190419998 931723392 553266463 967187391 208167145 ...

output:

0
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910
134949910

result:

ok 20 lines

Test #37:

score: 5
Accepted
time: 0ms
memory: 3892kb

input:

20 20
11 17
13 8
6 4
18 13
15 12
5 15
16 7
8 10
3 18
16 3
16 19
16 1
2 9
1 11
14 2
0 14
10 5
16 0
17 6
0 1
17 5
1 14
16 6
1 5
4 3
4 4
18 4
12 8
7 8
0 12
3 12
4 13
11 5
2 0
10 9
18 1
18 17
15 19
11 4
392505795 598245226 676917494 520541066 400541959 961423871 653272803 503778194 808079532 53571674 86...

output:

0
392505795
392505795
392505795
392505795
793047754
793047754
392505795
395420842
392505795
392505795
392505795
392505795
392505795
1069423289
392505795
395420842
392505795
392505795
392505795

result:

ok 20 lines

Test #38:

score: 5
Accepted
time: 1ms
memory: 3660kb

input:

20 20
1 13
3 12
0 8
2 4
8 5
10 17
10 0
10 11
13 16
19 9
6 18
10 14
10 2
7 1
5 6
4 15
11 3
9 7
10 19
4 4
7 2
1 0
9 1
3 1
10 15
18 0
6 3
19 8
15 0
16 5
15 5
4 10
0 0
14 1
9 10
17 11
17 0
12 4
13 6
32588836 700122468 935315183 460144664 72259535 979008218 991710456 656707652 436761227 637241986 4232798...

output:

0
362671255
732711304
537602043
176293815
32588836
516986682
32588836
32588836
149603530
362671255
32588836
32588836
32588836
219213726
32588836
32588836
378798728
32588836
32588836

result:

ok 20 lines

Test #39:

score: 5
Accepted
time: 0ms
memory: 5700kb

input:

20 20
17 7
12 3
15 0
17 6
7 12
10 16
2 15
17 1
17 4
14 19
17 5
0 9
17 2
18 14
4 10
19 13
9 18
3 11
11 8
3 19
13 19
4 19
6 19
4 19
9 19
2 19
15 19
3 19
15 19
13 19
9 19
4 19
11 19
10 19
3 19
12 19
17 19
7 19
15 19
601569352 457345748 950690477 940932136 419713541 265386030 296609107 328433361 2843618...

output:

0
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849
71625849

result:

ok 20 lines

Test #40:

score: 5
Accepted
time: 276ms
memory: 9188kb

input:

500 500
61 206
219 174
496 451
386 483
285 100
385 54
98 441
455 305
40 443
496 139
88 374
462 27
426 92
259 245
155 262
205 223
29 190
496 33
54 120
93 182
167 350
23 211
147 429
463 41
372 354
31 465
461 258
117 433
149 21
27 322
240 387
498 202
261 279
233 315
485 68
389 390
256 82
91 405
350 370...

output:

0
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
770946
7709...

result:

ok 500 lines

Test #41:

score: 5
Accepted
time: 282ms
memory: 9276kb

input:

500 500
411 418
150 393
315 115
204 312
270 177
232 356
167 235
314 443
125 65
169 456
102 483
269 55
317 62
124 132
173 271
150 22
257 198
331 71
26 361
171 476
182 289
149 11
460 208
287 134
116 43
135 376
148 408
324 167
295 118
300 50
150 368
422 185
400 475
375 409
428 390
377 294
290 218
256 1...

output:

0
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
6449391
64...

result:

ok 500 lines

Test #42:

score: 5
Accepted
time: 282ms
memory: 8316kb

input:

500 500
191 230
92 212
99 452
123 269
259 301
156 121
195 231
429 5
240 327
243 66
402 436
460 55
9 16
251 290
417 156
334 245
112 406
162 186
371 294
108 275
18 119
397 235
50 333
25 278
254 300
456 185
433 49
172 495
94 334
147 240
398 441
498 268
306 135
35 448
25 18
327 391
95 372
421 232
42 386...

output:

0
3197154
3197154
3197154
3197154
14362633
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
3197154
65618143
3197154
3197154
3197154
3197154
3197154
3197154
43588673
3197154
3197154...

result:

ok 500 lines

Test #43:

score: 5
Accepted
time: 302ms
memory: 9260kb

input:

500 500
372 50
64 368
71 283
194 472
261 189
129 131
87 243
332 46
191 163
136 458
36 220
161 313
6 490
331 359
391 214
48 422
337 144
397 40
475 425
416 333
51 437
343 318
66 56
49 5
241 402
231 252
83 486
53 411
347 388
468 241
353 124
275 168
486 377
137 108
278 137
28 286
181 416
443 48
366 371
...

output:

0
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
244238527
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
1401277
...

result:

ok 500 lines

Test #44:

score: 5
Accepted
time: 331ms
memory: 7784kb

input:

500 500
243 313
464 344
352 116
215 310
460 330
181 193
85 95
373 382
185 91
227 62
70 138
342 103
284 101
143 445
88 163
339 139
69 472
262 247
188 267
429 73
129 422
225 25
275 389
276 364
166 184
293 148
417 23
332 90
219 76
120 48
101 199
137 100
55 72
207 214
365 370
83 4
204 18
342 146
216 357...

output:

0
2185120
2185120
97049678
16788183
705908158
2185120
2185120
42725473
2185120
2185120
2185120
97049678
108699201
2185120
2185120
2185120
362023472
2185120
2185120
2185120
2185120
2185120
11181490
32623158
2185120
2185120
2185120
2185120
21435748
2185120
2185120
2185120
7221891
2185120
21435748
2185...

result:

ok 500 lines

Test #45:

score: 5
Accepted
time: 306ms
memory: 7708kb

input:

500 500
350 403
403 289
88 400
310 62
150 122
454 111
244 358
76 307
124 285
10 266
184 75
126 421
439 127
265 409
400 70
79 86
232 367
138 345
404 207
249 313
140 188
228 333
492 203
490 452
186 461
246 492
173 28
364 23
497 154
204 316
269 429
329 198
319 306
281 430
71 448
123 14
334 155
385 123
...

output:

0
1623578
1623578
1623578
1623578
1623578
1623578
1623578
1623578
1623578
58121494
1623578
1623578
1623578
1623578
1623578
1623578
1623578
1623578
12712309
1623578
45586847
1623578
1623578
12712309
1623578
1623578
55828524
1623578
5437637
1623578
1623578
1623578
1623578
1623578
1623578
1623578
16235...

result:

ok 500 lines

Test #46:

score: 5
Accepted
time: 273ms
memory: 8936kb

input:

500 500
204 252
121 383
17 289
23 184
185 53
140 235
153 172
180 276
149 360
165 275
155 210
108 19
410 29
366 78
113 217
245 477
421 30
262 69
313 13
157 84
445 324
197 491
14 299
317 463
448 395
346 147
285 270
187 415
269 273
296 264
317 16
317 72
273 308
62 340
317 167
399 468
65 334
15 363
217 ...

output:

0
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
320391
3203...

result:

ok 500 lines

Test #47:

score: 5
Accepted
time: 260ms
memory: 8552kb

input:

500 500
80 439
397 302
494 6
286 440
87 284
162 134
165 458
435 457
205 298
433 242
37 247
196 308
280 105
136 61
118 49
284 53
495 487
63 337
409 18
225 234
55 141
459 128
480 148
203 496
246 245
266 174
398 367
91 116
367 37
103 296
237 222
271 90
476 82
135 195
306 107
342 232
216 449
231 366
456...

output:

0
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
626982
6269...

result:

ok 500 lines

Test #48:

score: 5
Accepted
time: 0ms
memory: 8624kb

input:

500 500
151 54
116 9
420 190
389 13
463 185
492 41
153 275
58 401
348 418
308 236
286 264
273 279
405 439
434 409
310 455
227 443
65 472
136 22
314 226
425 463
436 177
122 304
53 183
97 386
123 235
288 193
379 14
154 435
168 58
186 442
67 87
270 464
278 436
264 239
459 194
330 107
238 36
391 295
327...

output:

0
-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
-1
-1
-1
-1
-1
537913710
-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
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 500 lines

Test #49:

score: 5
Accepted
time: 0ms
memory: 9260kb

input:

500 500
281 87
80 344
406 57
240 106
431 207
144 338
256 211
387 421
288 307
333 497
4 396
344 449
442 53
32 8
312 441
453 200
40 271
400 88
267 114
78 25
407 245
56 104
360 153
289 377
144 312
62 20
410 155
422 443
144 189
457 495
100 349
203 241
182 220
166 256
144 122
396 368
23 259
26 174
345 28...

output:

0
-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
-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
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 500 lines

Test #50:

score: 5
Accepted
time: 1ms
memory: 3612kb

input:

10 10
6 1
0 8
4 5
3 6
1 7
6 4
8 9
6 2
4 0
7 9
3 9
5 9
1 8
1 9
0 9
7 8
5 9
7 9
7 8
862356160 788992052 555344928 988358675 544571805 367930488 930965978 113006487 106980354 685457319

output:

0
106980354
106980354
106980354
106980354
106980354
106980354
106980354
106980354
106980354

result:

ok 10 lines

Test #51:

score: 5
Accepted
time: 1ms
memory: 3668kb

input:

10 10
4 5
7 2
0 8
2 9
8 4
7 0
4 3
0 1
8 6
7 4
3 6
2 2
3 5
7 1
6 9
3 9
4 4
9 6
9 2
624978489 419987641 360310630 109893809 16066306 444018075 314952966 440336058 617035212 664392432

output:

0
16066306
360310630
16066306
360310630
16066306
16066306
16066306
16066306
360310630

result:

ok 10 lines

Test #52:

score: 5
Accepted
time: 1ms
memory: 3600kb

input:

10 10
6 1
9 3
6 4
3 7
9 6
9 8
4 2
3 5
8 0
7 0
0 0
4 0
4 0
7 1
3 2
6 0
6 2
0 0
9 0
544668059 868121497 137406315 985565984 254857299 953292287 628906847 593822079 116451169 899911402

output:

0
-1
965130547
965130547
593822079
593822079
1222728926
710273248
-1
1493733481

result:

ok 10 lines

Test #53:

score: 5
Accepted
time: 1ms
memory: 3656kb

input:

20 20
5 13
16 8
12 9
4 14
2 6
2 3
10 18
7 10
7 0
4 5
17 11
7 12
4 7
5 17
18 19
16 4
16 2
7 1
8 15
10 16
8 19
15 19
6 19
9 16
10 19
6 19
16 18
5 17
13 18
1 16
5 19
18 18
19 19
11 19
6 17
12 17
14 19
12 19
6 19
184442386 954719942 433105203 178727138 438058180 26474227 787306104 14303762 213175066 544...

output:

0
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762
14303762

result:

ok 20 lines

Test #54:

score: 5
Accepted
time: 0ms
memory: 5724kb

input:

20 20
16 11
13 8
3 4
17 3
0 1
4 2
2 15
17 9
15 10
10 14
18 12
3 0
0 5
10 19
9 7
1 6
17 18
9 16
17 13
15 10
17 14
9 19
10 18
13 5
10 9
10 8
17 11
16 19
7 10
6 2
7 4
18 6
19 16
0 15
11 8
3 16
3 16
5 6
3 3
532432368 943572232 97392659 978981748 614404856 404652376 622219746 729818019 869681613 49505053...

output:

0
40773966
40773966
40773966
96561909
40773966
40773966
40773966
40773966
40773966
532432368
96561909
71217874
40773966
40773966
71217874
40773966
40773966
71217874
96561909

result:

ok 20 lines

Test #55:

score: 5
Accepted
time: 1ms
memory: 3628kb

input:

20 20
10 4
14 2
18 12
15 10
10 17
4 7
10 6
9 16
15 18
10 13
18 1
5 11
1 5
15 14
12 8
6 19
15 3
13 0
10 9
10 1
11 2
15 6
19 2
1 0
0 1
17 0
8 0
8 1
16 0
12 4
10 3
8 1
19 0
11 2
18 1
18 0
5 3
10 1
6 1
226902765 485478584 417306587 421702108 780333789 564315858 733926612 813892447 44879036 293367019 989...

output:

0
476423630
18831
612774245
485497415
18831
924100561
44897867
44897867
268363451
18831
18831
44897867
612774245
476423630
485497415
785182171
476423630
18831
612774245

result:

ok 20 lines

Test #56:

score: 5
Accepted
time: 268ms
memory: 7852kb

input:

500 500
258 364
231 276
95 376
274 1
12 37
231 2
34 221
266 315
155 284
424 342
196 289
145 97
409 207
348 283
386 120
255 287
401 295
266 49
66 485
59 301
117 48
429 491
133 358
371 294
256 406
338 24
436 111
481 83
397 15
266 435
266 173
354 35
314 482
410 441
465 456
230 347
192 134
112 353
236 1...

output:

0
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
603514
6035...

result:

ok 500 lines

Test #57:

score: 5
Accepted
time: 281ms
memory: 9072kb

input:

500 500
19 294
302 243
469 257
292 411
231 80
242 234
134 326
352 319
99 222
169 114
405 142
107 288
232 343
458 169
127 315
499 431
481 367
135 82
91 99
57 311
364 226
495 426
466 135
362 304
137 225
273 90
406 499
108 468
214 329
256 478
426 350
83 421
220 155
139 110
286 183
305 211
340 495
462 2...

output:

0
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
2368015
23...

result:

ok 500 lines

Test #58:

score: 5
Accepted
time: 270ms
memory: 9368kb

input:

500 500
149 444
334 30
170 18
344 196
286 25
433 88
105 310
445 31
72 411
112 241
221 64
244 441
407 205
0 468
39 284
138 74
19 395
222 313
365 324
60 267
99 41
251 141
137 70
257 63
279 220
24 269
130 218
374 84
396 231
176 301
195 396
155 447
240 182
181 442
7 430
285 233
109 335
334 91
272 473
25...

output:

0
5027619
5027619
5027619
5027619
732635566
5027619
5027619
66535878
5027619
9498498
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
5027619
74675479
5027619
5027619
5027619
5027619
9498498
5027619
5027619
5027619
5027619
5027619
502761...

result:

ok 500 lines

Test #59:

score: 5
Accepted
time: 0ms
memory: 3652kb

input:

5 5
1 4
0 1
0 2
1 3
0 4
3 4
3 3
3 4
4 4
356251622 244999661 599988275 914391300 963118056

output:

0
244999661
244999661
244999661
244999661

result:

ok 5 lines

Test #60:

score: 5
Accepted
time: 1ms
memory: 3832kb

input:

5 5
1 4
0 2
1 3
0 1
0 0
2 4
2 3
3 1
0 1
848600690 447099829 211804374 961820332 915051568

output:

0
848600690
848600690
1295700519
848600690

result:

ok 5 lines

Test #61:

score: 5
Accepted
time: 0ms
memory: 3692kb

input:

5 5
1 4
1 3
0 1
0 2
4 0
2 0
2 0
3 0
1 0
524427741 999411104 392621073 946301528 925732979

output:

0
-1
-1
-1
-1

result:

ok 5 lines

Test #62:

score: 5
Accepted
time: 1ms
memory: 3588kb

input:

10 10
4 9
2 5
0 1
2 6
1 3
3 8
1 4
0 2
3 7
8 5
4 6
1 5
9 6
9 6
5 6
7 6
4 6
2 4
7 6
741580620 234238988 485524663 335068921 30719219 982130970 259229780 111263847 906072058 295277236

output:

0
30719219
30719219
30719219
30719219
30719219
30719219
30719219
30719219
30719219

result:

ok 10 lines

Test #63:

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

input:

10 10
3 8
2 5
2 6
4 9
1 4
3 7
0 1
1 3
0 2
2 2
0 4
3 6
8 3
9 4
5 1
2 0
2 6
4 1
5 3
604510802 168223925 295654236 978000401 592767703 585283724 797821113 489121673 768487991 157072253

output:

0
168223925
168223925
168223925
168223925
295654236
295654236
168223925
168223925
168223925

result:

ok 10 lines

Test #64:

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

input:

10 10
2 5
0 2
0 1
3 7
1 3
3 8
4 9
1 4
2 6
5 0
0 0
1 0
0 0
9 0
6 1
4 0
3 0
6 0
8 0
542436999 588230248 779623364 83056795 901010660 198291041 965280026 462459787 659169979 15996895

output:

0
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 10 lines

Test #65:

score: 5
Accepted
time: 0ms
memory: 3756kb

input:

20 20
6 14
4 10
7 16
8 18
9 19
0 1
7 15
6 13
5 12
3 7
4 9
1 4
0 2
1 3
8 17
2 5
3 8
5 11
2 6
12 8
11 8
14 8
9 8
2 8
10 8
8 8
17 8
10 8
4 6
3 7
8 8
18 8
12 6
6 8
1 8
18 8
16 8
10 8
16 6
387698750 570432818 297569620 276137658 724453895 760946638 770833490 165973525 93544734 690933720 927284728 9203493...

output:

0
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734
93544734

result:

ok 20 lines

Test #66:

score: 5
Accepted
time: 1ms
memory: 5704kb

input:

20 20
5 12
4 10
8 17
7 15
6 13
5 11
8 18
4 9
0 1
1 3
0 2
2 5
2 6
7 16
6 14
9 19
3 7
1 4
3 8
18 7
13 4
5 5
9 2
6 8
8 5
16 4
6 4
15 0
9 6
13 6
8 8
6 8
19 0
5 1
1 2
12 1
19 2
11 1
3 8
872220622 193272299 730444521 18658514 693706168 869758470 711222143 847858150 819299744 2841546 493333146 848461327 83...

output:

0
193272299
2841546
2841546
2841546
2841546
18658514
18658514
38199713
2841546
2841546
2841546
2841546
990118919
730444521
2841546
836596786
2841546
848461327
2841546

result:

ok 20 lines

Test #67:

score: 5
Accepted
time: 0ms
memory: 3656kb

input:

20 20
8 18
7 16
2 5
7 15
9 19
5 12
4 9
2 6
3 8
1 3
6 14
8 17
6 13
0 1
1 4
0 2
3 7
4 10
5 11
0 0
6 0
7 0
5 0
15 0
13 0
14 0
4 0
9 0
4 0
2 0
10 1
14 0
11 0
15 0
16 1
2 0
8 1
14 0
8 1
396119312 796103047 43136967 857699803 696795723 719829249 854844550 114365970 350167633 360778181 952614697 992813896 ...

output:

0
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 20 lines

Test #68:

score: 5
Accepted
time: 251ms
memory: 7964kb

input:

500 500
18 37
206 414
177 356
98 197
44 90
223 447
157 316
106 214
174 349
71 143
75 151
15 31
11 24
210 421
111 224
123 247
175 351
5 12
213 427
221 443
12 25
187 376
106 213
178 358
42 86
209 420
12 26
7 16
67 136
40 81
184 370
66 133
152 306
212 426
211 423
207 415
43 88
77 156
70 142
185 372
46 ...

output:

0
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
124841
1248...

result:

ok 500 lines

Test #69:

score: 5
Accepted
time: 199ms
memory: 7632kb

input:

500 500
226 453
209 419
53 107
159 319
190 382
182 365
186 374
23 47
93 187
30 61
45 91
16 33
142 285
104 209
155 311
134 270
110 221
54 109
215 432
191 383
139 280
144 289
88 177
140 282
75 151
52 106
136 273
56 114
65 132
117 236
228 458
158 318
46 94
24 49
226 454
98 197
175 352
228 457
187 375
9...

output:

0
215463128
24422616
24422616
99861002
24422616
24422616
24422616
157972325
913883736
432317663
220803689
212510154
30012003
24422616
24422616
99861002
329960862
30012003
24422616
27722054
409688944
128127146
38620212
432317663
24422616
24422616
432317663
24422616
157972325
24422616
24422616
6720110...

result:

ok 500 lines

Test #70:

score: 0
Wrong Answer
time: 86ms
memory: 9028kb

input:

500 500
158 317
159 320
42 86
199 400
97 196
176 353
205 412
146 294
31 63
70 142
78 158
128 258
7 16
111 224
182 365
220 441
189 380
106 213
60 122
219 439
130 261
176 354
96 194
243 487
242 485
53 108
231 463
24 50
121 243
102 205
78 157
18 37
114 229
128 257
28 58
29 59
145 292
50 102
79 159
196 ...

output:

0
426929973
1229769403
767752519
-1
1557464610
-1
1106699971
931932380
689899491
-1
-1
816524750
869998882
463598310
169557843
1235334603
557276084
302515262
214418749
-1
196794437
796503145
-1
-1
582643108
603000484
298423585
435627769
-1
193261302
1303173557
689899491
1616955994
234255859
10971692...

result:

wrong answer 4th lines differ - expected: '438445005', found: '767752519'

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%