QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#88052#4962. Hopscotch Marathonxiaowuc1AC ✓910ms52584kbC++173.5kb2023-03-14 23:33:412023-03-14 23:33:52

详细

Test #1:

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

input:

7 6
10 20 30 40 50 60 70
2 25
3 36
100 42
5 10
7 70
1 1000

output:

-1
1
2
3
4
2
5

result:

ok 7 lines

Test #2:

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

input:

6 4
100 100 100 100 100 100
2 50
3 50
5 99
5 1

output:

-1
-1
-1
-1
4
2

result:

ok 6 lines

Test #3:

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

input:

1000 1000
51143979 413709934 71273172 160686048 922673356 293650470 418445073 696291502 313282290 319908265 151525743 28943169 524975844 735674016 165101939 554161861 643732833 686214175 651757271 451213772 734917921 364201043 315455657 804089236 338567555 348364522 747616568 706379579 195816846 710...

output:

-1
355
83
129
-1
185
-1
591
373
214
620
14
-1
530
134
494
-1
424
-1
320
681
275
-1
498
653
245
870
510
-1
398
322
171
426
501
806
313
-1
626
657
578
-1
83
-1
442
217
588
-1
125
508
684
918
185
-1
406
972
308
45
782
-1
513
619
204
624
703
765
353
-1
498
44
246
-1
488
-1
194
776
204
608
489
-1
430
742...

result:

ok 1000 lines

Test #4:

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

input:

1000 1000
232522358 830757893 488856652 608834394 217941891 230008673 616112850 86488073 896799531 519976507 854936712 322091443 27587841 928807657 655151362 558263580 960846175 801918518 324646601 135995114 510283652 845665504 416463022 694416883 643628003 390986802 960045291 688329121 834201692 24...

output:

-1
617
539
471
448
139
-1
77
-1
367
-1
195
192
573
523
441
-1
462
-1
113
455
573
-1
409
-1
296
-1
446
-1
11
-1
663
92
306
515
511
-1
359
440
128
-1
224
-1
570
718
705
-1
466
-1
524
236
8
-1
58
935
246
603
594
-1
495
-1
1
185
476
487
38
-1
399
751
48
-1
475
-1
294
244
233
748
491
-1
550
597
703
-1
13...

result:

ok 1000 lines

Test #5:

score: 0
Accepted
time: 8ms
memory: 5932kb

input:

1000 1000
437761503 923181451 158329349 984637283 160764091 813099263 610735639 539973112 719248087 202320309 474247315 610793706 989654413 914324300 364722969 471585637 15139018 792062806 455765881 117052841 995259125 828729250 157188182 326691541 917033439 51503561 796357351 45842122 419786819 828...

output:

-1
793
169
841
412
483
-1
454
788
165
-1
372
-1
682
322
400
71
471
-1
96
874
641
-1
205
-1
39
858
33
-1
456
-1
140
82
314
422
271
-1
445
754
137
-1
40
-1
681
66
103
-1
59
-1
313
146
511
-1
558
454
532
748
19
-1
474
-1
510
297
408
469
250
-1
150
197
232
-1
368
-1
364
254
652
-1
35
-1
205
798
739
-1
4...

result:

ok 1000 lines

Test #6:

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

input:

1000 1000
738179198 161942145 335115263 14980947 118273684 641955491 670002315 484484299 131904527 417111622 261345042 665560543 699094048 385116622 442439712 41408581 415429348 132703309 554095211 757594381 793229273 526006781 37236303 130325676 636125619 879830711 391435995 754492767 792482932 638...

output:

-1
123
384
13
254
373
-1
376
191
276
-1
380
-1
286
375
28
-1
83
-1
467
711
373
422
79
-1
603
438
514
-1
342
-1
458
535
609
252
377
-1
515
301
539
-1
314
-1
694
448
250
-1
229
-1
126
382
389
-1
373
-1
537
116
700
-1
197
-1
722
477
619
477
396
-1
558
548
356
-1
373
-1
492
548
592
861
325
-1
493
126
13...

result:

ok 1000 lines

Test #7:

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

input:

1000 1000
220722594 207419809 733995675 88562092 819926670 919161398 456774312 946543022 613434170 1510149 497993804 457890311 950145172 918841738 941874408 844278045 902816035 672209272 489796286 999909628 612529962 740023372 461981382 618520472 310538037 176177819 369931174 213617997 271774327 649...

output:

-1
173
824
79
-1
568
-1
775
698
4
-1
293
-1
662
790
702
-1
411
-1
717
578
553
-1
388
683
136
424
164
-1
369
25
757
399
88
974
402
-1
182
845
583
-1
511
-1
602
263
240
-1
479
-1
176
842
712
-1
228
-1
699
271
402
360
129
-1
490
870
490
-1
312
174
449
125
623
-1
378
-1
30
766
131
799
319
-1
549
364
695...

result:

ok 1000 lines

Test #8:

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

input:

1000 1000
866766635 149324028 450470164 118161445 601542757 10169623 560987416 381516056 496697623 42975341 791480493 707763922 907929072 561463229 443226621 511823894 504438451 24086517 779475123 890139841 108956851 436245110 199099959 418983209 840743086 156562109 266402204 235827377 834166707 995...

output:

-1
126
567
102
-1
3
-1
314
622
23
-1
448
-1
374
423
398
-1
12
-1
596
101
322
-1
285
-1
126
367
190
-1
574
-1
616
925
645
670
314
-1
324
299
16
-1
106
-1
680
245
455
-1
388
-1
190
863
273
-1
359
88
621
708
129
-1
354
-1
400
19
402
-1
172
-1
76
244
101
-1
97
-1
273
863
553
-1
103
-1
77
920
787
-1
262
...

result:

ok 1000 lines

Test #9:

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

input:

1000 1000
492476293 286956565 55706527 774000925 17002321 800648678 688593320 299349318 97340513 612486756 901966263 447063096 762212645 277620539 245138493 644461740 551270198 955871174 786609654 532936289 544978906 478587154 206418458 720477895 902200308 336928334 67020230 800472019 131122767 9678...

output:

-1
293
57
690
50
526
-1
306
104
476
-1
312
-1
237
208
590
-1
608
-1
419
578
421
-1
477
-1
296
74
636
-1
556
-1
190
386
707
751
404
-1
751
254
161
-1
465
-1
468
683
541
-1
172
692
165
181
602
-1
357
677
119
-1
625
-1
377
-1
623
748
733
-1
373
-1
377
795
66
-1
28
-1
285
360
696
-1
494
-1
595
-1
396
-1...

result:

ok 1000 lines

Test #10:

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

input:

1000 1000
965897982 354286686 448061610 884569470 93340341 786557583 525544043 661287781 388188394 213700156 187777171 191323802 968783646 52733090 974073782 493510792 498514324 88287936 70176265 870053704 889630606 718746320 729843586 651303716 878344624 286434180 459235356 501094493 514054798 4521...

output:

-1
254
523
657
177
452
-1
476
469
141
688
113
-1
36
837
352
-1
56
477
542
833
476
-1
375
-1
204
535
324
-1
243
163
224
574
47
105
86
-1
242
317
156
-1
226
-1
61
104
113
-1
151
82
67
806
633
-1
273
726
32
868
299
-1
222
-1
525
87
551
388
107
-1
284
747
262
-1
290
-1
168
251
339
-1
249
-1
339
907
685
...

result:

ok 1000 lines

Test #11:

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

input:

700 1000
710294868 757346790 453015833 767388395 52218948 553350595 246548812 490117397 137889199 916321718 569634908 933641434 60075917 230067894 417374720 747067575 915559494 818890266 122793343 528857026 402198170 903861813 722423382 720988496 877285617 525169764 143270187 607692824 443650485 230...

output:

-1
666
528
670
117
360
743
447
153
653
-1
595
335
174
344
656
-1
525
825
402
346
703
-1
455
-1
443
157
481
-1
130
-1
313
746
134
801
320
-1
162
841
624
-1
81
-1
73
338
575
-1
217
-1
162
866
682
-1
7
625
510
54
424
-1
126
-1
621
647
806
540
338
-1
702
-1
523
-1
206
-1
90
44
409
4
321
-1
500
401
603
-...

result:

ok 700 lines

Test #12:

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

input:

1000 700
990946671 595315458 635592120 735221330 246338496 609173074 373655175 236982854 644523088 786525592 160201809 831829787 196614775 71570753 922781282 148464273 533859009 604056399 975152173 916250620 177475722 591214885 503781186 450955914 392705556 196419562 220471827 108286967 338206371 49...

output:

-1
363
529
454
395
266
-1
154
537
416
537
360
-1
34
557
97
-1
264
-1
466
120
339
-1
196
636
122
174
60
-1
198
-1
567
382
495
188
423
-1
217
184
428
-1
339
-1
209
41
582
-1
15
348
73
501
487
-1
326
-1
17
485
573
-1
81
-1
148
496
346
134
347
-1
435
388
218
-1
325
-1
398
228
174
-1
53
-1
127
479
283
-1...

result:

ok 1000 lines

Test #13:

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

input:

1000 1000
1 2971 17668 17757 20020 29879 8404 24009 18297 26011 13377 28996 2551 1200 11449 28847 1230 11594 1352 21879 28324 13680 2511 34474 28886 15103 26532 7637 641 39253 273 21370 36515 14279 28665 2184 197 30327 5802 5570 693 16696 402 7114 26945 14086 1 3168 28844 12152 19488 19408 67 33553 ...

output:

-1
87
464
520
637
717
258
713
482
636
540
692
150
33
288
892
153
269
158
535
730
331
557
853
955
401
735
181
219
942
93
618
956
387
804
54
176
838
141
129
892
385
639
162
680
403
381
77
938
288
489
511
373
823
501
743
855
912
-1
927
186
372
802
100
645
325
238
653
618
329
697
148
373
565
906
382
796...

result:

ok 1000 lines

Test #14:

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

input:

1000 1000
1 2381 25699 9199 5642 19883 25846 13886 27799 11372 6352 19274 7409 7828 16663 27455 55 6015 5362 38686 19079 32153 2039 16596 6422 2007 18452 18467 1047 24643 399 27267 3841 15377 26410 17071 272 13325 7394 39429 223 15515 337 16269 872 33678 285 32440 11390 30259 16752 24923 1 41077 263...

output:

-1
69
726
277
191
494
873
416
785
301
313
480
559
195
449
819
5
148
875
977
504
838
486
419
225
53
527
478
443
576
202
812
106
438
758
436
397
380
197
995
210
380
220
440
29
933
919
785
394
770
460
647
984
997
774
450
448
307
355
332
582
424
412
478
646
122
304
899
130
556
515
780
537
145
52
722
189...

result:

ok 1000 lines

Test #15:

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

input:

1000 1000
1 26838 32000 2535 15922 22144 26009 28014 10991 10204 16922 14241 8843 19942 23177 19007 9003 76 4384 35433 11400 12290 1 36596 18354 28388 2507 37095 222 38763 409 1303 13031 11967 1373 16983 1 25544 437 10652 1 28439 365 27528 35039 8719 380 33308 5296 19537 14554 9485 240 36154 33081 1...

output:

-1
760
914
81
538
558
825
795
317
264
734
360
689
513
609
570
816
1
571
878
296
314
15
891
613
753
79
925
90
899
333
41
335
324
43
438
104
682
9
276
84
663
898
700
888
236
817
803
157
518
407
247
699
874
927
319
937
453
118
530
181
836
572
394
190
421
87
304
606
497
186
400
645
110
650
683
499
27
68...

result:

ok 1000 lines

Test #16:

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

input:

1000 1000
1 4029 15266 10560 14712 495 112 14452 30433 36271 1643 19094 3628 15949 6722 27857 7345 12022 6815 36591 17887 34709 487 21285 15070 32542 25217 22128 264 913 624 20678 23188 33880 29125 37343 785 10222 19243 33431 342 39879 100 14857 26516 5761 106 22892 12903 9572 1511 23947 24 18691 32...

output:

-1
131
460
326
477
13
6
471
934
972
82
494
272
408
165
912
628
306
810
984
496
945
187
551
493
944
782
595
84
22
221
706
668
978
843
967
766
282
541
904
380
977
147
390
734
179
486
597
434
240
45
725
127
481
981
964
190
798
67
886
-1
627
505
118
22
421
378
338
716
886
24
291
768
869
770
986
611
257
...

result:

ok 1000 lines

Test #17:

score: 0
Accepted
time: 2ms
memory: 6460kb

input:

1000 1000
1 10404 31739 22144 19311 28898 504 30891 8678 23079 17153 15053 3609 29319 20536 16880 7039 6387 1632 16109 27664 12958 4110 11416 26833 37909 7190 19731 506 23861 718 13294 3259 15914 7311 35051 905 7103 35245 15832 551 39445 438 6349 36846 1363 1 14456 6383 15628 32760 21028 1 31669 286...

output:

-1
307
910
627
636
707
23
876
260
572
741
374
256
717
541
469
685
159
200
400
725
329
817
287
882
964
220
480
152
563
390
383
90
419
219
859
655
198
922
393
954
931
929
164
969
35
46
359
239
386
873
530
332
780
817
159
972
621
244
997
878
673
9
179
69
799
753
115
648
451
-1
942
193
319
955
232
857
5...

result:

ok 1000 lines

Test #18:

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

input:

1000 1000
1 7841 15789 32194 14542 12414 24040 12423 4038 8212 20272 22902 3106 20962 23719 28339 9053 27186 7331 20060 24049 31323 3926 16743 15680 7676 15916 14558 1030 1 589 30148 29587 14113 28666 34768 1112 21822 35300 34988 237 37894 307 23842 28866 3521 398 16283 15768 25178 7579 4372 129 229...

output:

-1
232
431
980
460
296
805
373
121
208
933
550
212
523
607
855
873
650
963
506
616
790
750
403
503
199
439
368
491
2
416
928
753
381
827
850
809
603
948
908
673
903
378
599
734
93
727
390
520
639
196
114
815
553
338
90
396
770
343
956
219
331
311
621
520
439
561
218
728
558
517
913
238
263
813
14
38...

result:

ok 1000 lines

Test #19:

score: 0
Accepted
time: 8ms
memory: 6360kb

input:

1000 1000
1 4456 18552 6510 18350 24320 5374 24281 12166 16413 8203 23502 6664 6666 10487 13337 6292 34571 2043 30499 35144 36464 1315 22864 14751 17848 18376 25053 647 31225 1314 12256 10276 25580 28464 8012 496 3031 26759 23805 320 37158 197 26207 8351 9908 468 22771 7525 6864 32642 16076 1 36816 ...

output:

-1
142
547
207
644
633
203
754
371
436
420
611
510
188
274
417
625
887
251
806
943
969
333
589
529
474
541
669
222
767
716
383
270
710
836
201
676
79
731
635
241
901
557
697
220
280
634
587
278
190
908
434
135
951
416
571
443
305
564
177
198
1
460
218
681
296
698
849
886
547
847
563
738
178
532
721
...

result:

ok 1000 lines

Test #20:

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

input:

1000 1000
1 2348 14913 4990 6901 20878 9664 26227 18395 19658 10688 38106 6555 38918 20543 23886 8133 32030 2045 35793 31996 25918 4076 3765 21232 25923 14690 20564 1349 38996 112 16968 5485 8291 25662 13805 510 8751 26459 29558 392 7910 151 34020 23706 15861 200 24288 17185 14501 26650 1466 152 182...

output:

-1
72
420
166
266
528
320
797
538
537
526
944
469
995
571
738
839
794
285
937
837
701
959
96
774
718
412
531
351
944
100
526
155
236
755
340
502
257
724
779
668
200
430
900
656
461
549
619
577
383
735
43
245
450
184
670
217
827
957
879
332
768
863
210
983
755
1000
912
354
11
417
210
893
604
630
28
9...

result:

ok 1000 lines

Test #21:

score: 0
Accepted
time: 2ms
memory: 6516kb

input:

700 1000
1 10516 7547 30424 15262 20271 26176 1004 1393 19869 17940 1230 13161 1584 28226 11055 1 20378 5754 8182 25114 1438 4153 17945 23085 27343 12137 37693 1671 18962 468 6746 8705 29315 25060 24068 539 30739 11553 15902 239 2825 18 2918 13076 1194 123 34666 5870 37928 16479 30982 67 17384 16416...

output:

-1
323
229
935
526
511
925
37
55
512
888
34
927
49
772
344
11
520
793
218
684
49
823
451
822
746
356
983
652
457
332
217
244
821
753
608
928
887
318
404
665
78
165
91
353
39
381
891
208
984
443
838
61
441
495
487
198
447
381
83
277
863
577
114
991
379
842
350
705
246
-1
412
771
392
779
243
685
953
6...

result:

ok 700 lines

Test #22:

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

input:

1000 700
1 11738 4639 22659 20758 6789 15029 6492 19333 10893 1663 5760 8082 1872 24879 3425 4439 2143 1040 26970 20018 2429 3513 5008 21300 25144 19790 10018 126 12318 439 3844 25302 23540 7728 23637 78 507 19683 23955 1 6813 1 16303 7131 15562 232 4592 16264 18098 12954 6052 1 24166 23980 10244 62...

output:

-1
377
136
693
667
185
523
207
561
297
95
153
607
49
642
103
449
56
112
671
530
62
661
134
691
674
582
280
40
309
506
124
665
645
251
603
33
14
516
607
161
181
395
435
193
463
479
123
561
468
360
165
203
613
675
287
20
671
424
384
83
107
124
435
685
446
175
645
436
507
175
427
578
278
342
368
393
32...

result:

ok 1000 lines

Test #23:

score: 0
Accepted
time: 747ms
memory: 20608kb

input:

100000 100000
482288842 410812017 590887505 681683956 824237130 476228099 783613484 243080993 603772623 577650755 735000777 283877458 867663315 543833537 737561084 588477541 218989579 375487010 352085951 677889911 895586269 487332937 120768315 562475029 132176546 862909666 692324697 43497699 7279732...

output:

-1
32996
71363
54667
-1
28800
-1
19503
72961
38609
-1
17054
-1
38098
63340
47178
-1
22805
-1
45194
83774
35852
-1
33945
26831
64297
83396
2961
84481
9261
-1
44550
76375
11733
-1
55100
-1
71621
78238
61926
-1
47410
-1
60397
25488
44662
-1
45039
7797
42851
86101
51063
-1
48220
53772
40033
63
32385
-1
...

result:

ok 100000 lines

Test #24:

score: 0
Accepted
time: 810ms
memory: 20932kb

input:

100000 100000
848782117 641162868 928157054 945181740 980316292 88357643 66237211 74782307 669628455 739258902 476877408 269786430 323711003 24270977 120432490 968473695 813038578 13334026 981035809 970951829 276604030 119316123 856133825 789894270 288460268 508235530 93802179 740441109 606940232 34...

output:

-1
50998
-1
75258
-1
5273
18861
5979
80323
48921
-1
16335
-1
1701
10366
77083
-1
793
-1
64217
26414
8874
-1
47436
56937
37662
11396
51646
-1
18897
-1
63923
55814
20139
-1
22996
-1
48307
34117
22129
-1
14467
-1
70581
44705
5331
-1
17616
10764
40253
80301
49297
-1
40446
85585
2866
84452
36882
-1
3000
...

result:

ok 100000 lines

Test #25:

score: 0
Accepted
time: 758ms
memory: 20616kb

input:

100000 100000
227416973 819918619 584178097 415579342 750359261 537263945 868428918 845891585 209429333 283621376 440511609 944963835 580653885 420135657 837225293 530077637 975964283 318349222 65078088 997517943 68629662 173198323 756410864 669581082 448387305 9045698 269791310 961663372 50320245 5...

output:

-1
65447
69098
33293
-1
32091
-1
67438
24672
19033
-1
56247
-1
29406
70998
42316
-1
19061
49206
66400
6300
12811
-1
39904
89634
669
32144
67181
58032
31667
-1
68738
46762
27090
40374
41273
-1
30813
45123
25670
-1
30131
-1
36868
66651
21169
-1
55621
-1
12922
94265
33914
-1
1798
12063
3697
96286
67201...

result:

ok 100000 lines

Test #26:

score: 0
Accepted
time: 265ms
memory: 20416kb

input:

30000 100000
673048104 605885769 579743437 791018999 72861991 621280729 994798663 53883344 568065518 251045324 857218186 926445723 384343277 281472429 861074458 284701416 67839254 118332959 876362260 588002527 646703449 448349800 267123190 883575129 825195579 115930312 103405650 937097800 245597301 ...

output:

-1
48674
69825
63519
14780
37470
-1
4354
68346
16673
-1
55752
-1
19483
74291
22780
46544
7109
-1
39559
60484
32919
-1
53156
-1
8538
12403
65757
-1
54293
-1
75417
61673
30785
-1
20461
-1
14500
12099
45043
-1
14151
-1
53934
74750
26627
-1
46505
-1
6157
34046
856
3464
20547
40712
17198
-1
66652
-1
4986...

result:

ok 30000 lines

Test #27:

score: 0
Accepted
time: 555ms
memory: 11016kb

input:

100000 30000
773581094 812481504 128513090 200816936 655305068 809328617 299032353 252827457 465319924 84663254 165438327 984420737 394762795 375569041 814526767 16087105 141214442 400987541 649495202 803804029 998939156 651131237 917967128 605443050 21913075 678673709 126178831 703702089 556042729 ...

output:

-1
19513
4733
4784
-1
14606
25040
6054
16866
1645
21465
17799
-1
7918
20935
378
28971
7219
-1
16181
28047
14284
-1
10950
1269
15262
4645
14805
-1
6809
-1
13627
11307
5001
418
8797
-1
6800
16390
19293
-1
13113
-1
11735
18912
10381
-1
979
17715
10688
257
18238
-1
3970
-1
1302
9744
14911
-1
11307
-1
14...

result:

ok 100000 lines

Test #28:

score: 0
Accepted
time: 910ms
memory: 52584kb

input:

100000 100000
1 1758927 2883479 1009649 180915 1693679 2615315 1159205 2123836 1059988 645199 1837264 4221 2617636 2928813 377880 504533 2942262 317134 932895 10267 2429479 114146 1110093 196286 3104006 3149348 2146190 140806 1515341 87061 1149665 190698 1882453 2147940 1907395 41717 1870209 2620131...

output:

-1
53617
85510
30711
6028
42719
89608
35320
63056
27154
30499
46394
306
67889
77974
11299
48850
74345
42600
23973
284
63395
22534
27965
6497
84065
93517
55562
49261
36516
50369
35009
5165
51932
62039
48164
39357
52706
71245
82773
95651
8377
58314
71138
8476
88020
39189
59469
15239
76058
62105
98050
...

result:

ok 100000 lines

Test #29:

score: 0
Accepted
time: 910ms
memory: 52156kb

input:

100000 100000
1 856375 1456275 898647 2678443 1265339 808818 1466803 2404623 3574166 1314250 3371021 339369 33843 3490093 1780955 646066 711063 218255 3845556 758011 3055885 42244 234638 2663335 2170793 695797 3664463 208290 604940 94458 1598656 2739542 1496878 132253 2704742 19615 1272783 2303861 6...

output:

-1
25866
43034
27080
89862
31727
27342
44620
71019
91918
62205
84858
23912
850
92801
54006
63184
17766
29523
98638
20246
79645
8331
5824
89326
58415
20467
94701
75258
14430
53448
48552
74340
41380
3716
68006
20107
35664
62438
16807
44647
96915
86955
8566
1708
5115
38917
25374
66344
14267
23027
56320...

result:

ok 100000 lines

Test #30:

score: 0
Accepted
time: 904ms
memory: 51908kb

input:

100000 100000
1 2826658 2894998 2386473 408456 561238 901395 156595 3344185 3043721 387198 877540 885613 2364255 2365417 2145801 867998 3826381 55827 454607 2318367 3028146 336897 2374958 177807 2525868 187758 681700 245825 3534528 133672 2551776 2008138 2251706 1045937 2664872 14644 2688579 2875456...

output:

-1
86294
85794
72731
13776
14342
30495
4873
99095
78243
18417
22238
62897
60855
62789
65319
84588
96692
7383
11882
62063
78994
68025
59713
6004
68271
5567
17676
87074
85218
74335
77829
54282
62076
29876
67161
14083
75761
78262
98866
35665
20138
59152
26385
23719
4641
70815
80530
68569
25291
85509
89...

result:

ok 100000 lines

Test #31:

score: 0
Accepted
time: 330ms
memory: 50712kb

input:

30000 100000
1 2300195 1296218 1397086 1469103 1612590 2515525 950893 2914104 905842 19218 920058 742253 787747 3269481 2646694 526116 2364508 255178 752187 547575 1210732 195795 3542287 1436832 982788 1490397 2677064 275243 3948273 157576 174905 3536072 588873 3069161 1353161 62713 1223681 1827708 ...

output:

-1
70171
38664
42614
49461
40841
85862
28839
86651
23256
888
23261
53205
20305
87081
80649
52513
59852
34577
19300
14832
31545
40066
89512
48395
26513
44456
69446
97149
95042
88422
5180
96151
16277
88145
34220
63436
34455
49933
86086
81545
93101
34081
59297
73564
92503
42686
62668
23095
1072
62739
5...

result:

ok 30000 lines

Test #32:

score: 0
Accepted
time: 603ms
memory: 20676kb

input:

100000 30000
1 610691 526208 757185 257455 988751 836476 451639 656289 480454 161174 251144 281821 276931 4536 881332 45441 289757 159713 665752 200382 525912 65525 1100505 163144 823777 543909 77996 52908 52489 6101 335015 182317 699028 561582 773207 27009 9057 459340 749532 16026 535146 8706 33949...

output:

-1
18646
15631
23138
8633
24903
28455
13748
19397
12343
7720
6353
19748
7175
131
26881
4472
7300
21727
17118
5431
13709
13538
27656
5532
22187
16139
2029
18746
1272
3806
10181
5028
19352
16126
19474
26630
281
12482
19241
25394
12923
17675
8837
22636
1866
4571
21860
6893
12913
24703
8962
14483
17855
...

result:

ok 100000 lines

Test #33:

score: 0
Accepted
time: 741ms
memory: 45660kb

input:

100000 100000
1 1714180 2993576 2367180 122872 1144879 2075751 1809856 1681920 1136896 1388688 129206 226798 1811751 3408557 895852 87366 313256 71095 438607 2044773 977969 66736 2079639 3397067 1236238 591505 1311592 6788 4157656 27838 4178341 453600 2420526 3101661 32553 4834 3014199 1253116 54369...

output:

-1
37719
65845
52225
2819
24485
46683
39869
36978
24371
58773
2850
97436
39002
73827
19639
51429
6784
56904
9476
44347
21025
78050
44585
75950
26768
13081
28212
13252
88351
82212
91907
9910
52722
68048
735
28144
65703
27226
11730
1654
6283
31671
67841
44913
2296
86693
8207
18801
4855
97957
58894
711...

result:

ok 100000 lines

Test #34:

score: 0
Accepted
time: 763ms
memory: 45344kb

input:

100000 100000
1 4511121 606479 1135249 2093243 2545921 2809802 3249218 2351237 2124606 2154614 1759110 31605 1652075 2251295 2412416 20614 4624312 75257 2714360 3705121 1613257 19965 2707581 216645 718960 2057120 2620414 25727 2277850 5650 2421535 1042801 446050 314226 4595228 15763 911427 581678 35...

output:

-1
99507
13405
25111
47016
54647
63200
71769
51935
45821
91538
37820
12979
35817
48875
53322
12271
99095
58741
58424
80449
34993
24084
58047
4872
15655
45443
56532
51871
48581
20880
53520
22778
9772
6903
98455
82065
19987
12732
76566
43367
31849
36007
68639
50429
65424
73468
65653
99956
38022
8966
9...

result:

ok 100000 lines

Test #35:

score: 0
Accepted
time: 761ms
memory: 45820kb

input:

100000 100000
1 3255600 995275 2806710 2508419 3083478 1900344 3845947 922609 4305993 1414720 760946 164094 3909720 2147843 746069 149737 2448152 104956 2683625 2508951 953936 41848 1622701 3088703 3815664 1889987 1251976 26854 862643 6136 4341721 397826 970351 4004534 1752539 8618 1607069 3795014 1...

output:

-1
71491
21813
61651
55929
65842
42426
84495
20214
92434
59549
16323
69427
83942
46227
16459
87891
52320
83987
57535
54233
20528
52533
34594
68870
82520
41349
26843
55413
18283
22708
95434
8615
21089
87629
37321
44600
34852
82308
32888
5118
97197
40453
88060
5104
16763
73115
56576
20634
27544
48084
...

result:

ok 100000 lines

Test #36:

score: 0
Accepted
time: 283ms
memory: 45000kb

input:

30000 100000
1 325409 2247773 4310968 1331827 1898413 4434439 2264204 3773315 4144517 1828890 4609966 183616 91504 4465657 3094166 88113 4527823 113919 1440947 4065699 1511166 5468 2654945 2777193 4417865 859698 1560115 29410 4299485 30523 1063379 1714770 4395370 1726060 630111 14712 4163589 3724009...

output:

-1
7144
49499
95009
30009
40777
99567
49892
83238
89226
78041
98781
78239
1960
96748
68229
49440
97047
89665
31128
88299
32684
7180
56984
62298
95813
18968
33667
63784
91407
90024
23524
37312
95540
37943
13573
73871
90777
81191
62829
40701
21788
42820
99129
3892
39742
98071
9056
63702
95938
74446
40...

result:

ok 30000 lines

Test #37:

score: 0
Accepted
time: 510ms
memory: 18180kb

input:

100000 30000
1 724843 199273 1020833 760067 1013063 287101 9878 447678 275867 642594 167000 47692 793901 862100 792498 45433 328010 32370 466694 48640 1274918 1942 1296486 235125 1038756 1228048 335275 8619 657354 1476 14485 830212 720424 28286 1292171 875 574322 494133 1335752 1301 801752 1953 8438...

output:

-1
15929
4363
22427
17047
21703
6397
224
9874
5877
27490
3565
19593
17046
18719
17435
25460
6996
24793
9999
1052
27486
2382
27765
5234
22457
27055
7171
15901
13974
3899
315
18104
15625
622
27678
6970
12504
10766
28664
9958
17018
14338
18224
15886
8303
5245
10370
6483
15377
21880
11074
483
1171
17176...

result:

ok 100000 lines

Test #38:

score: 0
Accepted
time: 586ms
memory: 15940kb

input:

100000 100000
1 564927 368404 648182 616538 464859 149154 372240 539429 447873 37130 41392 30715 531521 779725 531141 27064 826836 31052 799230 806008 273060 5946 604213 254497 287119 660626 729955 16597 553159 15092 252167 295273 93876 202581 332711 14794 662263 264748 578357 503 176399 6897 403150...

output:

-1
69460
46321
79924
84133
51540
20216
45671
68163
50725
12541
4317
22741
60734
91616
65235
27628
91859
43865
90658
96097
31315
9876
67201
34380
33352
83425
83848
62129
59652
69628
30714
35342
10909
25083
36534
96438
78986
31508
65626
4119
18629
85999
46561
10810
60781
45625
65730
67708
67113
75536
...

result:

ok 100000 lines

Test #39:

score: 0
Accepted
time: 580ms
memory: 15916kb

input:

100000 100000
1 799087 690738 601356 306106 46353 434573 154463 576492 24092 77516 823918 27833 215460 234409 6147 47674 333986 10533 172162 367068 356696 7973 336480 46327 803394 640211 10214 8534 357208 3004 339575 463472 646631 103375 869909 3838 39775 817410 304382 8740 417901 3570 566927 338003...

output:

-1
97448
86087
73518
40694
5021
59326
18645
71943
2777
23921
90916
18635
24263
27159
711
51940
36404
14176
19048
42877
40461
16527
36672
6115
93290
79639
1162
29895
37777
12023
41440
54967
75895
12678
95939
20694
4657
97602
34145
93801
44619
50081
65003
38732
96999
6270
9533
94126
63321
38324
72149
...

result:

ok 100000 lines

Test #40:

score: 0
Accepted
time: 569ms
memory: 16188kb

input:

100000 100000
1 139184 486203 220955 455542 738014 67302 22644 344411 546886 283873 443593 69418 356682 254562 351993 51939 790542 9394 834055 436027 740994 46667 606599 723742 450863 381883 175194 695 229420 13356 737757 535315 650341 553116 840152 10886 570413 295054 635729 2617 818808 2360 162484...

output:

-1
17481
61976
27895
62435
82343
9494
3082
43909
62934
93987
50184
56773
41376
30697
43884
53754
88236
13802
94857
52729
85940
93352
68434
98073
53722
48600
20523
1661
25462
61385
90709
65489
77367
69893
93591
84147
68869
35921
72937
31525
89073
31727
19116
6901
56928
94877
2433
1320
79912
398
36714...

result:

ok 100000 lines

Test #41:

score: 0
Accepted
time: 198ms
memory: 15592kb

input:

30000 100000
1 317459 548385 664512 367359 106118 124092 396576 296407 152321 174331 835510 1784 496657 620957 643925 82630 512719 67232 700699 594387 45194 27867 203980 259638 269372 747158 80790 10557 271669 16652 372213 810263 358380 112281 67314 4521 511532 35740 126714 733 897771 6276 662324 68...

output:

-1
38391
68911
81800
49286
11256
16408
48549
36754
16590
57238
93008
1265
56587
72925
78961
84546
56693
94427
79514
70800
4938
58353
21973
34108
30622
94285
8836
31975
28447
73535
45362
97762
41807
13470
7060
29946
60612
4127
13915
7376
97276
74097
76176
81082
99868
28432
60568
48240
54357
52134
474...

result:

ok 30000 lines

Test #42:

score: 0
Accepted
time: 404ms
memory: 9812kb

input:

100000 30000
1 201087 52012 232849 169909 44390 68490 65245 145022 212237 82997 143591 38548 4738 103784 168803 9315 121202 16815 179740 240092 155427 1615 145939 95164 125496 46136 142686 4685 107748 2069 52206 27382 184626 14086 165472 3002 246452 57900 57696 423 144446 786 25369 211715 122538 824...

output:

-1
23821
6163
27596
22012
4544
8884
7616
17684
23251
25691
15428
29120
589
11900
20076
11034
13014
24641
19765
27735
17212
2246
15657
12344
14295
5433
15900
14520
11213
12558
5958
2860
20871
1647
17709
26843
28412
6569
6095
1369
15212
9061
2501
24160
14391
18064
8963
2317
29938
12066
9774
19376
6730...

result:

ok 100000 lines

Test #43:

score: 0
Accepted
time: 589ms
memory: 20976kb

input:

100000 100000
744672541 726947096 625899980 481085538 886048970 556069436 500132364 172592968 659254517 109376399 14574044 996061840 564645467 405105727 541675881 832670614 721998289 256011896 316320826 454391510 113379337 362101898 983190838 164118988 477228815 931255558 547523024 25751104 58852132...

output:

-1
7
5
1
27
1
6
1
5
1
2
4
44
1
5
7
59
1
67
1
4
1
19
1
23
7
5
1
63
1
75
1
4
1
23
4
72
1
4
1
43
4
108
1
5
1
6
4
11
7
5
1
71
4
5
1
5
7
226
1
132
1
4
1
24
1
26
7
4
1
169
1
143
7
5
1
6
4
125
1
5
7
9
1
23
7
4
1
68
4
23
7
4
1
23
2
174
1
5
7
12
1
71
1
4
1
186
1
123
1
5
6
145
4
19
1
4
7
23
1
30
1
4
7
27
4
13...

result:

ok 100000 lines

Test #44:

score: 0
Accepted
time: 208ms
memory: 20444kb

input:

30000 100000
545001698 157863099 610624090 13451003 144679712 744261682 610997869 468402622 184817432 781947079 909568696 833456958 897566072 454387422 362865630 236884690 461973470 812203013 842917976 231648331 385118558 463479284 753771968 962189593 756835490 950575257 690304080 445887301 35203825...

output:

-1
1
6
1
2
6
32
7
2
7
33
6
42
7
2
1
13
6
50
1
2
7
13
6
23
8
6
7
57
2
60
1
6
7
22
6
10
1
6
2
15
5
114
7
2
1
332
1
32
7
7
7
140
2
2
7
6
7
93
2
5
7
6
1
23
6
209
7
7
7
48
1
60
1
2
7
10
1
29
7
6
7
7
6
2
7
7
7
222
2
23
7
7
7
2
2
58
7
2
1
92
2
26
1
2
8
114
2
50
7
2
1
14
1
2
1
6
7
3
1
10
1
6
7
23
2
38
7
6
7...

result:

ok 30000 lines

Test #45:

score: 0
Accepted
time: 410ms
memory: 11164kb

input:

100000 30000
593137202 988971145 922811559 775702404 253797058 997390150 569418371 791953642 51151896 274600423 295883794 201087817 984796058 147838294 288678636 389282152 229230570 892556329 435127331 332907753 456815527 695142662 834490512 145337456 377789771 418059033 29889554 390522232 53994938 ...

output:

-1
3
12
1
6
3
1
1
4
1
1
1
84
1
4
1
7
3
5
1
1
1
13
1
6
1
4
1
29
1
53
1
2
1
1
1
5
3
4
1
100
1
32
1
6
1
49
3
1
1
4
1
63
3
1
1
4
1
554
1
21
1
1
1
6
1
207
1
4
1
44
1
11
1
6
1
1
1
148
1
10
1
203
1
8
1
12
1
36
1
1
1
3
1
5
1
174
1
1
1
187
1
85
1
1
1
39
1
11
2
4
1
85
3
6
1
12
1
1
1
2
1
4
1
6
1
319
1
12
1
80
...

result:

ok 100000 lines