QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#80895#2536. Akcijaxi110 ✓324ms36568kbC++141.2kb2023-02-25 10:44:232023-02-25 10:44:25

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 4ms
memory: 35052kb

input:

1919 1
126746165 1373
126746165 1621
126746165 1157
126746165 1647
126746165 1046
126746165 1626
126746165 813
126746165 1197
126746165 1240
126746165 738
126746165 840
126746165 571
126746165 1712
126746165 109
126746165 1850
126746165 524
126746165 736
126746165 917
126746165 1520
126746165 1559
1...

output:

1893 239930490345

result:

ok single line: '1893 239930490345'

Test #2:

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

input:

2000 1
955444834 1441
955444834 1866
955444834 1
955444834 257
955444834 605
955444834 1999
955444834 294
955444834 473
955444834 185
955444834 794
955444834 373
955444834 776
955444834 692
955444834 1340
955444834 794
955444834 1872
955444834 1078
955444834 1693
955444834 839
955444834 627
95544483...

output:

1966 1878404543644

result:

ok single line: '1966 1878404543644'

Test #3:

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

input:

1837 1
404217733 48
404217733 1712
404217733 1010
404217733 1741
404217733 800
404217733 891
404217733 773
404217733 589
404217733 607
404217733 284
404217733 376
404217733 1284
404217733 1138
404217733 221
404217733 551
404217733 892
404217733 491
404217733 1163
404217733 1142
404217733 1504
404217...

output:

1772 716273822876

result:

ok single line: '1772 716273822876'

Test #4:

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

input:

1814 1
673960138 1285
673960138 1524
673960138 528
673960138 221
673960138 927
673960138 1033
673960138 1620
673960138 793
673960138 1626
673960138 35
673960138 228
673960138 74
673960138 376
673960138 450
673960138 94
673960138 170
673960138 800
673960138 1261
673960138 55
673960138 264
673960138 8...

output:

1795 1209758447710

result:

ok single line: '1795 1209758447710'

Test #5:

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

input:

1981 1
655754816 1085
655754816 343
655754816 1927
655754816 1695
655754816 1417
655754816 1207
655754816 1383
655754816 1184
655754816 429
655754816 281
655754816 1935
655754816 445
655754816 13
655754816 1384
655754816 502
655754816 1790
655754816 862
655754816 1254
655754816 1544
655754816 11
655...

output:

1951 1279377646016

result:

ok single line: '1951 1279377646016'

Test #6:

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

input:

1811 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
93494...

output:

1 934941692

result:

ok single line: '1 934941692'

Test #7:

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

input:

1990 1
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
35646...

output:

5 1782303005

result:

ok single line: '5 1782303005'

Test #8:

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

input:

1845 1
439788326 4
439788326 2
439788326 3
439788326 5
439788326 4
439788326 3
439788326 5
439788326 2
439788326 3
439788326 2
439788326 3
439788326 1
439788326 1
439788326 3
439788326 2
439788326 1
439788326 3
439788326 3
439788326 4
439788326 5
439788326 5
439788326 2
439788326 2
439788326 2
43978...

output:

5 2198941630

result:

ok single line: '5 2198941630'

Test #9:

score: 0
Accepted
time: 14ms
memory: 33156kb

input:

1802 1
332342588 41
332342588 11
332342588 37
332342588 16
332342588 23
332342588 35
332342588 10
332342588 18
332342588 1
332342588 26
332342588 19
332342588 33
332342588 17
332342588 17
332342588 22
332342588 37
332342588 21
332342588 39
332342588 24
332342588 7
332342588 23
332342588 30
332342588...

output:

42 13958388696

result:

ok single line: '42 13958388696'

Test #10:

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

input:

1873 1
613474075 936
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 936
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 936
613474075 1
613474075 936
613474075...

output:

923 566236571225

result:

ok single line: '923 566236571225'

Test #11:

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

input:

1 1
22282234 1

output:

1 22282234

result:

ok single line: '1 22282234'

Test #12:

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

input:

2 1
713738007 1
713738007 1

output:

1 713738007

result:

ok single line: '1 713738007'

Test #13:

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

input:

47 1
754775836 35
754775836 42
754775836 13
754775836 5
754775836 26
754775836 35
754775836 1
754775836 17
754775836 44
754775836 2
754775836 43
754775836 14
754775836 2
754775836 4
754775836 45
754775836 35
754775836 7
754775836 18
754775836 14
754775836 32
754775836 29
754775836 47
754775836 45
75...

output:

43 32455360948

result:

ok single line: '43 32455360948'

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #14:

score: 20
Accepted
time: 14ms
memory: 34916kb

input:

1919 1
126746165 1373
668827372 1621
842598033 1157
119717982 1647
527842278 1046
492815129 1626
917098873 813
346103003 1197
144760418 1240
339840086 738
518170881 840
527423104 571
783646464 1712
77685618 109
74284316 1850
300769843 524
944005181 736
969138120 917
789000286 1520
358649048 1559
189...

output:

1893 934318516761

result:

ok single line: '1893 934318516761'

Test #15:

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

input:

2000 1
955444834 1441
87345570 1866
807140020 1
452949476 257
818869981 605
161621665 1999
504099265 294
598031629 473
226306660 185
713394097 794
44533525 373
345561041 776
361821668 692
39849424 1340
545901297 794
745021573 1872
939642412 1078
719782870 1693
269723920 839
462215558 627
695935199 1...

output:

1966 990213629004

result:

ok single line: '1966 990213629004'

Test #16:

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

input:

1837 1
404217733 48
760111913 1712
635231398 1010
112054506 1741
297775642 800
988252633 891
547492872 773
447889215 589
184474212 607
98312137 284
514971126 376
705702660 1284
428618641 1138
284561840 221
229651857 551
239129770 892
679610908 491
661999745 1163
564888989 1142
606821489 1504
2943314...

output:

1772 845948441583

result:

ok single line: '1772 845948441583'

Test #17:

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

input:

1814 1
673960138 1285
81028746 1524
421252653 528
23986853 221
239140624 927
891249203 1033
962614277 1620
792355265 793
628225416 1626
970645055 35
385299960 228
737128556 74
351438607 376
255496258 450
185170885 94
93888187 170
198693111 800
844239992 1261
716879039 55
162912511 264
307460806 829
...

output:

1795 883197439380

result:

ok single line: '1795 883197439380'

Test #18:

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

input:

1981 1
655754816 1085
678728908 343
133130441 1927
373977459 1695
938792353 1417
905077842 1207
24418879 1383
525819604 1184
807011577 429
558345553 281
160730060 1935
933294628 445
321504227 13
231009700 1384
362825113 502
450254037 1790
410951067 862
732893408 1254
664094189 1544
36187258 11
72576...

output:

1951 945978796419

result:

ok single line: '1951 945978796419'

Test #19:

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

input:

1811 1
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
9448251...

output:

1 411136

result:

ok single line: '1 411136'

Test #20:

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

input:

1990 1
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 6765520

result:

ok single line: '5 6765520'

Test #21:

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

input:

1845 1
439788326 4
290322352 2
986205736 3
710314349 5
685726300 4
853875260 3
971736329 5
438979736 2
886818995 3
172808191 2
420841453 3
510881405 1
431215518 1
199291335 3
467841446 2
683750115 1
257564895 3
202281694 3
826348885 4
385400539 5
217140246 5
456942122 2
41496387 2
829740419 2
751741...

output:

5 6933249

result:

ok single line: '5 6933249'

Test #22:

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

input:

1802 1
332342588 41
970441845 11
719381653 37
922576512 16
177275034 23
488255662 35
253050193 10
620786108 18
709863734 1
807506164 26
624934371 19
657679271 33
968188704 17
636677279 17
733619521 22
326275757 37
349557250 21
712026273 39
248279211 24
165404787 7
373691690 23
404033360 30
769815056...

output:

42 500827803

result:

ok single line: '42 500827803'

Test #23:

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

input:

1873 1
613474075 936
191550631 1
565168039 1
940922606 1
723793989 1
936250872 1
651398486 1
818818788 1
554633771 1
275490534 936
290775497 1
843102091 1
650604084 1
499561988 1
758111235 1
459142648 1
400436681 1
730320150 1
756878960 1
964498323 1
145557078 936
896291394 1
759694823 936
850781148...

output:

923 459262234401

result:

ok single line: '923 459262234401'

Test #24:

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

input:

1 1
22282234 1

output:

1 22282234

result:

ok single line: '1 22282234'

Test #25:

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

input:

2 1
713738007 1
497377109 1

output:

1 497377109

result:

ok single line: '1 497377109'

Test #26:

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

input:

47 1
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
5856...

output:

43 19340489859

result:

ok single line: '43 19340489859'

Subtask #3:

score: 20
Accepted

Test #27:

score: 20
Accepted
time: 13ms
memory: 34880kb

input:

1919 2
126746165 1373
668827372 1621
842598033 1157
119717982 1647
527842278 1046
492815129 1626
917098873 813
346103003 1197
144760418 1240
339840086 738
518170881 840
527423104 571
783646464 1712
77685618 109
74284316 1850
300769843 524
944005181 736
969138120 917
789000286 1520
358649048 1559
189...

output:

1893 934318516761
1893 934319294852

result:

ok 2 lines

Test #28:

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

input:

2000 2
955444834 1441
87345570 1866
807140020 1
452949476 257
818869981 605
161621665 1999
504099265 294
598031629 473
226306660 185
713394097 794
44533525 373
345561041 776
361821668 692
39849424 1340
545901297 794
745021573 1872
939642412 1078
719782870 1693
269723920 839
462215558 627
695935199 1...

output:

1966 990213629004
1966 990214368560

result:

ok 2 lines

Test #29:

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

input:

1837 2
404217733 48
760111913 1712
635231398 1010
112054506 1741
297775642 800
988252633 891
547492872 773
447889215 589
184474212 607
98312137 284
514971126 376
705702660 1284
428618641 1138
284561840 221
229651857 551
239129770 892
679610908 491
661999745 1163
564888989 1142
606821489 1504
2943314...

output:

1772 845948441583
1772 845949272280

result:

ok 2 lines

Test #30:

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

input:

1814 2
673960138 1285
81028746 1524
421252653 528
23986853 221
239140624 927
891249203 1033
962614277 1620
792355265 793
628225416 1626
970645055 35
385299960 228
737128556 74
351438607 376
255496258 450
185170885 94
93888187 170
198693111 800
844239992 1261
716879039 55
162912511 264
307460806 829
...

output:

1795 883197439380
1795 883197614490

result:

ok 2 lines

Test #31:

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

input:

1981 2
655754816 1085
678728908 343
133130441 1927
373977459 1695
938792353 1417
905077842 1207
24418879 1383
525819604 1184
807011577 429
558345553 281
160730060 1935
933294628 445
321504227 13
231009700 1384
362825113 502
450254037 1790
410951067 862
732893408 1254
664094189 1544
36187258 11
72576...

output:

1951 945978796419
1951 945979383131

result:

ok 2 lines

Test #32:

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

input:

1811 2
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
9448251...

output:

1 411136
1 1259454

result:

ok 2 lines

Test #33:

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

input:

1990 2
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 6765520
5 7314334

result:

ok 2 lines

Test #34:

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

input:

1845 2
439788326 4
290322352 2
986205736 3
710314349 5
685726300 4
853875260 3
971736329 5
438979736 2
886818995 3
172808191 2
420841453 3
510881405 1
431215518 1
199291335 3
467841446 2
683750115 1
257564895 3
202281694 3
826348885 4
385400539 5
217140246 5
456942122 2
41496387 2
829740419 2
751741...

output:

5 6933249
5 7333923

result:

ok 2 lines

Test #35:

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

input:

1802 2
332342588 41
970441845 11
719381653 37
922576512 16
177275034 23
488255662 35
253050193 10
620786108 18
709863734 1
807506164 26
624934371 19
657679271 33
968188704 17
636677279 17
733619521 22
326275757 37
349557250 21
712026273 39
248279211 24
165404787 7
373691690 23
404033360 30
769815056...

output:

42 500827803
42 500922238

result:

ok 2 lines

Test #36:

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

input:

1873 2
613474075 936
191550631 1
565168039 1
940922606 1
723793989 1
936250872 1
651398486 1
818818788 1
554633771 1
275490534 936
290775497 1
843102091 1
650604084 1
499561988 1
758111235 1
459142648 1
400436681 1
730320150 1
756878960 1
964498323 1
145557078 936
896291394 1
759694823 936
850781148...

output:

923 459262234401
923 459262425406

result:

ok 2 lines

Test #37:

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

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #38:

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

input:

2 2
713738007 1
497377109 1

output:

1 497377109
1 713738007

result:

ok 2 lines

Test #39:

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

input:

47 2
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
5856...

output:

43 19340489859
43 19423796403

result:

ok 2 lines

Subtask #4:

score: 10
Accepted

Test #40:

score: 10
Accepted
time: 5ms
memory: 3604kb

input:

19 1910
872059530 14
567896598 17
515371564 12
609933207 17
421749461 11
993851818 17
897732743 9
76274388 12
362276371 13
93554371 8
695969254 9
21709341 6
395396341 17
894018749 2
835539456 19
150700500 6
934168428 8
934249073 10
508532761 16

output:

18 9787132136
18 9846734881
18 9846815526
18 9883251211
18 9886965205
18 9908924424
18 10085014700
18 10171050747
18 10213087356
18 10265612390
18 10272451193
18 10359234493
18 10385587613
18 10418707583
18 10630283454
18 10687429583
18 10704709566
18 10759274613
17 8852883063
17 8852963708
17 88893...

result:

ok 1910 lines

Test #41:

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

input:

20 1883
735748837 15
563229302 19
219528931 1
476153920 3
942871419 7
246506664 20
29407208 3
573822564 5
719909005 2
981359250 8
448077622 4
490919926 8
599888635 7
462459069 14
150739326 8
212709849 19
835789078 11
859792932 17
768767483 9
861954306 7

output:

16 7673541346
16 7917296431
16 7935607017
16 7961673088
16 8016524130
16 8042590201
16 8044575726
16 8055011961
16 8059341732
16 8081078032
16 8087418030
16 8125492839
16 8140258845
16 8163980670
16 8168335143
16 8173921420
16 8178746676
16 8179362102
16 8205428173
16 8206822974
16 8260279215
16 828...

result:

ok 1883 lines

Test #42:

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

input:

18 1887
666937376 1
878564254 17
568161994 10
733393578 18
144504113 8
535325978 9
551450306 8
630068459 6
198040795 6
772830221 3
843247194 4
277560202 13
916948987 12
586485641 3
530682767 6
437343456 9
908988480 5
190035793 12

output:

15 7845503699
15 7951396544
15 7988265461
15 8021813517
15 8031848279
15 8058682434
15 8066883614
15 8083007942
15 8087554803
15 8087651153
15 8102265252
15 8124423720
15 8137300587
15 8153424915
15 8158068126
15 8164575279
15 8168006538
15 8180990464
15 8203041873
15 8208158097
15 8219166201
15 822...

result:

ok 1887 lines

Test #43:

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

input:

18 1910
32079340 13
156090008 16
490520938 6
486590052 3
697013119 10
231474055 11
299023445 17
380002679 8
726123174 17
528963793 1
634434113 3
980649968 1
25750352 4
822299809 5
600065005 1
278370194 2
432031451 8
445711516 13

output:

15 6032043925
15 6103145137
15 6137514245
15 6179887986
15 6250989198
15 6388107844
15 6459209056
15 6483730100
15 6631574161
15 6839794019
14 5209744116
14 5280845328
14 5305920751
14 5315214436
14 5335030806
14 5357588177
14 5377021963
14 5406132018
14 5411391071
14 5428689389
14 5440501126
14 545...

result:

ok 1910 lines

Test #44:

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

input:

20 1994
212262730 11
614563104 4
926631931 20
388153742 18
648681729 15
175924270 13
420655750 14
641382438 12
871822259 5
9648746 3
657694080 20
415077754 5
286124047 1
47416497 14
691397676 6
870871304 19
468308899 9
20427661 13
42713839 16
844289622 1

output:

19 8409758456
19 8967924031
18 7483126525
18 7537936197
18 7538887152
18 7718360780
18 7752064376
18 7761076727
18 7768376018
18 7795195352
18 7941449557
18 7989102706
18 7994680702
18 8021604714
18 8041292100
18 8096101772
18 8097052727
18 8123634409
18 8197495726
18 8233834186
18 8276526355
18 831...

result:

ok 1994 lines

Test #45:

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

input:

18 19
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1

output:

1 86695278
1 96444602
1 201564132
1 221963002
1 318687106
1 380252829
1 390559518
1 425992688
1 522523573
1 524427523
1 556647080
1 656854970
1 697351162
1 822387303
1 867885853
1 892631472
1 934941692
1 986350949
0 0

result:

ok 19 lines

Test #46:

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

input:

20 1979
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5

output:

5 561015036
5 692627263
5 696308098
5 733568609
5 785857717
5 801880160
5 805560995
5 806617432
5 810668724
5 814349559
5 842821506
5 848482777
5 851610070
5 852163612
5 854604335
5 872704225
5 876385060
5 889424123
5 895110614
5 903899178
5 905053721
5 905675533
5 913645571
5 915870329
5 924658893
...

result:

ok 1979 lines

Test #47:

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

input:

18 1815
729317650 4
932868461 2
863008224 3
355235938 5
409032428 4
421918593 3
70798611 5
724056782 2
309393983 3
721895170 2
976668613 3
745210736 1
229120780 1
371485616 3
485464402 2
998073295 1
999874855 3
281947182 3

output:

5 1246496494
5 1300292984
5 1308588127
5 1336034928
5 1346134939
5 1359021104
5 1362384617
5 1373581740
5 1386467905
5 1388861330
5 1389831418
5 1412817594
5 1422566913
5 1426408142
5 1435673373
5 1439294307
5 1440264395
5 1442657820
5 1448559538
5 1450013714
5 1476363403
5 1486106350
5 1488499775
5...

result:

ok 1815 lines

Test #48:

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

input:

18 1975
596309475 4
157329680 1
583456292 4
753259864 2
817005401 3
432371535 4
764906373 1
878606404 2
665378586 1
22850648 3
457512559 2
378828995 4
310391949 2
517676786 2
939326414 3
358387154 4
57778895 2
234935851 4

output:

4 472895074
4 596346377
4 616788218
4 625957343
4 670330758
4 673952548
4 694394389
4 725508128
4 747936929
4 749408646
4 769850487
4 773077953
4 773503333
4 793945174
4 808431580
4 817845692
4 821415515
4 823393027
4 828873421
4 833242180
4 834268698
4 847487714
4 848959431
4 869401272
4 871388232
...

result:

ok 1975 lines

Test #49:

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

input:

19 72
338989816 9
943345633 1
401527024 1
788833071 1
41605751 1
750660847 1
753281912 1
614996176 1
145411643 1
964227808 9
146036383 1
716077316 1
588236342 1
593839023 1
754225697 1
414976697 1
675975267 1
745647850 1
606524229 1

output:

3 1344823375
3 1448629267
3 1449254007
3 1704744648
3 1718194321
3 1891453966
3 1897056647
3 1909741853
3 1918213800
3 1979192891
3 2019294940
3 2048865474
3 2053878471
3 2056499536
3 2057443321
3 2092050695
3 2246563257
2 380595567
2 484401459
2 485026199
2 740516840
2 753966513
2 927226158
2 93282...

result:

ok 72 lines

Test #50:

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

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #51:

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

input:

2 3
713738007 1
497377109 1

output:

1 497377109
1 713738007
0 0

result:

ok 3 lines

Test #52:

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

input:

19 1830
725846878 15
650776859 17
517039125 6
915617815 2
979831113 11
2425840 14
203878170 1
559662185 7
158885737 18
592745896 1
974170910 18
521170032 6
734788441 1
824777765 2
172568301 19
489680949 14
820940534 3
604668194 8
22344351 6

output:

16 8228666943
16 8319506993
16 8617534669
16 8708374719
16 8759577214
16 8850417264
16 8940406588
15 7248835830
15 7254496033
15 7339675880
15 7345336083
15 7403889178
15 7407726409
15 7498566459
15 7502820065
15 7577890084
15 7593660115
15 7623998749
15 7637703556
15 7643363759
15 7668730134
15 766...

result:

ok 1830 lines

Subtask #5:

score: 30
Accepted

Test #53:

score: 30
Accepted
time: 2ms
memory: 3900kb

input:

96 96
390531470 69
349016804 82
612244127 58
41258987 83
470944790 53
681046579 82
109569778 41
700928268 60
224279712 63
681889278 37
173204769 43
701269722 29
624757038 86
271969787 6
444924884 93
500697380 27
509702566 37
262449977 46
669488879 77
170692294 78
362932916 51
118514404 47
724509790 ...

output:

94 42881894279
94 42885031902
94 42886655954
94 42893770642
94 42895394694
94 42898532317
94 42925575942
94 42928026677
94 42934314682
94 42936765417
94 42937452305
94 42939076357
94 42939903040
94 42941527092
94 42942082928
94 42950821668
94 42953959291
94 42955583343
94 42966521813
94 42971243241
...

result:

ok 96 lines

Test #54:

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

input:

100 94
728894101 73
984472362 94
227233955 1
977586505 13
285128553 31
320973763 100
527822662 15
627483044 24
57297596 10
607643414 40
616454087 19
659211250 39
157548605 35
632762003 67
280224048 40
751359820 94
248050921 54
109880759 85
572785958 42
444589230 32
745606493 69
529418708 53
44472160...

output:

93 47229378659
93 47232402986
93 47240022572
93 47243046899
93 47243080404
93 47244995575
93 47248019902
93 47253724317
93 47255639488
93 47258663815
93 47258716409
93 47269360322
93 47274333325
93 47284977238
93 47311778501
93 47314802828
93 47325480246
93 47327395417
93 47330419744
93 47341116251
...

result:

ok 94 lines

Test #55:

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

input:

92 94
833824080 3
502342051 86
575100606 51
294391290 88
857061142 41
584339058 45
874174469 39
88148751 30
393357153 31
883565650 15
913593771 19
553126421 65
436234512 57
237294962 12
29208319 28
801689376 45
265404538 25
463360153 59
72095717 58
953808886 76
540105291 49
859270862 63
753811898 13...

output:

81 39299786951
81 39311847968
81 39312702071
81 39322169910
81 39323024013
81 39329815398
81 39334624591
81 39335085030
81 39335478694
81 39337877883
81 39338731986
81 39339206579
81 39340137340
81 39342946819
81 39347539711
81 39349012273
81 39349528521
81 39350793003
81 39352198357
81 39352592021
...

result:

ok 94 lines

Test #56:

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

input:

90 96
629484261 64
935306493 76
304392773 27
871049171 11
298476078 46
401713369 52
488146744 81
80745508 40
220557674 81
816664936 2
216228749 12
68472304 4
551940937 19
903061070 23
93661821 5
743709824 9
519246013 40
478781953 63
388883752 3
389060106 14
759872727 42
554152379 41
801812652 59
491...

output:

83 39941151331
83 39950335016
83 39953411848
83 39954850187
83 39957150426
83 39960227258
83 39961665597
83 39969410943
83 39970849282
83 39973163230
83 39973926114
83 39976240062
83 39977678401
83 39985423747
83 39986862086
83 39989938918
83 39992239157
83 39993677496
83 39996754328
83 40005938013
...

result:

ok 96 lines

Test #57:

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

input:

99 100
997942797 55
389611075 18
253554815 97
684571690 85
870702547 71
205564015 61
135486527 70
534502368 60
81289102 22
195899258 15
736144729 97
986106280 23
463665422 1
338951827 70
891407683 26
940889978 90
447510152 44
749649611 63
971379429 78
382652692 1
434677763 20
971281184 57
355595918 ...

output:

92 45920709473
92 45922574199
92 45944404733
92 45957903338
92 45958920531
92 45959768064
92 45960785257
92 46000892272
92 46001722203
92 46003586929
92 46005558455
92 46007423181
92 46012687929
92 46014390877
92 46015408070
92 46016255603
92 46017272796
92 46025417463
92 46026186534
92 46027203727
...

result:

ok 100 lines

Test #58:

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

input:

90 91
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
94482519...

output:

1 1763267
1 2377496
1 6157975
1 15655962
1 24624220
1 26098971
1 69263754
1 86695278
1 96444602
1 97225921
1 100247796
1 119078792
1 127877669
1 154795234
1 169983923
1 177825450
1 190316581
1 201564132
1 202308690
1 214496470
1 219209494
1 219639845
1 221963002
1 260425780
1 272288258
1 278203924
1...

result:

ok 91 lines

Test #59:

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

input:

100 99
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 324767380
5 327325796
5 343035094
5 346872135
5 351823658
5 351892640
5 357373441
5 362581433
5 365139849
5 367601938
5 370160354
5 370257120
5 371093583
5 371369997
5 373082739
5 373928413
5 375641155
5 376390502
5 378948918
5 381871303
5 384429719
5 386802881
5 389361297
5 389637711
5 389706693
...

result:

ok 99 lines

Test #60:

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

input:

92 90
973264570 4
852089299 2
193758456 3
368621045 5
795770336 4
322486632 3
453520673 5
541117717 2
457901037 3
669215845 2
681160198 3
705418654 1
561466257 1
278244915 3
445480431 2
435079180 1
1532101 3
716465796 3
99065944 4
471910939 5
761706427 5
839382115 2
563011796 2
735114705 2
747496604...

output:

5 243868061
5 247450067
5 262919655
5 285581097
5 289469511
5 291771729
5 299021523
5 302862167
5 303946339
5 304939099
5 309878292
5 318331755
5 319415927
5 321913761
5 322507891
5 327600541
5 333543795
5 333791173
5 337373179
5 338560573
5 340993197
5 341040967
5 342077369
5 344575203
5 344983910
...

result:

ok 90 lines

Test #61:

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

input:

90 99
611963689 9
627027155 3
280522489 8
41781762 4
194145632 5
479342947 8
401801721 3
202048698 4
509720171 1
673295877 6
268952783 4
231195725 7
905370083 4
162102917 4
908068381 5
575680564 8
775958558 5
107789503 9
474618094 5
785075390 2
588933550 5
672841926 7
536587289 7
402372406 4
7919946...

output:

9 627312446
9 629519191
9 634964641
9 653783136
9 666569284
9 669104270
9 671311015
9 676756465
9 680305569
9 682512314
9 687957764
9 695273397
9 695574960
9 700718847
9 702925592
9 706776259
9 708361108
9 711427019
9 713633764
9 713668575
9 715896048
9 716512151
9 718718896
9 719079214
9 719114025
...

result:

ok 99 lines

Test #62:

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

input:

94 90
993426020 47
340110397 1
42364286 1
694836282 1
46011633 1
685105256 1
182658669 1
495744089 1
300355472 1
56972124 47
433165733 1
41415211 1
723395243 1
182032973 1
257277309 1
853139301 1
190546605 1
174596917 1
137821497 1
148969545 1
75253797 47
378941690 1
682441131 47
520226255 47
934283...

output:

47 18328508147
47 18337846245
47 18338795320
47 18342442667
47 18400357226
47 18407084475
47 18409695324
47 18410644399
47 18413802305
47 18414291746
47 18423908340
47 18425986692
47 18433246438
47 18434195513
47 18434252531
47 18435324790
47 18436273865
47 18437842860
47 18438147877
47 18439921212
...

result:

ok 90 lines

Test #63:

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

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #64:

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

input:

2 3
713738007 1
497377109 1

output:

1 497377109
1 713738007
0 0

result:

ok 3 lines

Test #65:

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

input:

47 91
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
585...

output:

43 19340489859
43 19423796403
43 19575291033
43 19614982748
43 19658597577
43 19682150952
43 19726395713
43 19765457496
43 19786847908
43 19836405037
43 19849783922
43 19919711581
43 19951189059
43 19956643841
43 19961196887
43 20011641254
43 20024576260
43 20034495603
43 20068056806
43 20094947798
...

result:

ok 91 lines

Subtask #6:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #66:

score: 20
Accepted
time: 322ms
memory: 35040kb

input:

1919 1910
126746165 1373
668827372 1621
842598033 1157
119717982 1647
527842278 1046
492815129 1626
917098873 813
346103003 1197
144760418 1240
339840086 738
518170881 840
527423104 571
783646464 1712
77685618 109
74284316 1850
300769843 524
944005181 736
969138120 917
789000286 1520
358649048 1559
...

output:

1893 934318516761
1893 934319294852
1893 934319704636
1893 934320081855
1893 934320365836
1893 934320396794
1893 934320482727
1893 934320910788
1893 934321057994
1893 934321143927
1893 934321167805
1893 934321174885
1893 934321269730
1893 934321293479
1893 934321450025
1893 934321836085
1893 9343219...

result:

ok 1910 lines

Test #67:

score: 0
Accepted
time: 324ms
memory: 36568kb

input:

2000 1883
955444834 1441
87345570 1866
807140020 1
452949476 257
818869981 605
161621665 1999
504099265 294
598031629 473
226306660 185
713394097 794
44533525 373
345561041 776
361821668 692
39849424 1340
545901297 794
745021573 1872
939642412 1078
719782870 1693
269723920 839
462215558 627
69593519...

output:

1966 990213629004
1966 990214368560
1966 990214594667
1966 990214763118
1966 990214869122
1966 990215055833
1966 990215281940
1966 990215450391
1966 990215556395
1966 990215661920
1966 990215847174
1966 990215888027
1966 990215919531
1966 990216021496
1966 990216056478
1966 990216073281
1966 9902161...

result:

ok 1883 lines

Test #68:

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

input:

1837 1887
404217733 48
760111913 1712
635231398 1010
112054506 1741
297775642 800
988252633 891
547492872 773
447889215 589
184474212 607
98312137 284
514971126 376
705702660 1284
428618641 1138
284561840 221
229651857 551
239129770 892
679610908 491
661999745 1163
564888989 1142
606821489 1504
2943...

output:

1772 845948441583
1772 845949272280
1772 845949746508
1772 845950514578
1772 845950577205
1772 845951121095
1772 845951663105
1772 845951819503
1772 845951825244
1772 845952204672
1772 845952363393
1772 845952426020
1772 845952968030
1772 845953130169
1772 845953194090
1772 845953446970
1772 8459535...

result:

ok 1887 lines

Test #69:

score: 0
Accepted
time: 295ms
memory: 33524kb

input:

1814 1910
673960138 1285
81028746 1524
421252653 528
23986853 221
239140624 927
891249203 1033
962614277 1620
792355265 793
628225416 1626
970645055 35
385299960 228
737128556 74
351438607 376
255496258 450
185170885 94
93888187 170
198693111 800
844239992 1261
716879039 55
162912511 264
307460806 8...

output:

1795 883197439380
1795 883197614490
1795 883198013960
1795 883198107081
1795 883198506845
1795 883198581851
1795 883198620433
1795 883198880655
1795 883198881495
1795 883198981321
1795 883199074442
1795 883199156431
1795 883199249552
1795 883199280965
1795 883199374086
1795 883199456075
1795 8831994...

result:

ok 1910 lines

Test #70:

score: 0
Accepted
time: 323ms
memory: 36104kb

input:

1981 1994
655754816 1085
678728908 343
133130441 1927
373977459 1695
938792353 1417
905077842 1207
24418879 1383
525819604 1184
807011577 429
558345553 281
160730060 1935
933294628 445
321504227 13
231009700 1384
362825113 502
450254037 1790
410951067 862
732893408 1254
664094189 1544
36187258 11
72...

output:

1951 945978796419
1951 945979383131
1951 945982728854
1951 945984509853
1951 945988289742
1951 945988566113
1951 945988876454
1951 945991025278
1951 945991215778
1951 945991911836
1951 945992222177
1951 945992498548
1951 945993692835
1951 945994003176
1951 945994279547
1951 945994371001
1951 9459945...

result:

ok 1994 lines

Test #71:

score: 0
Accepted
time: 43ms
memory: 33424kb

input:

1811 1812
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
9448...

output:

1 411136
1 1259454
1 1763267
1 1802565
1 2260071
1 2377496
1 3275708
1 3554562
1 3741263
1 3867654
1 4318360
1 4774225
1 4803308
1 5049938
1 5265075
1 5436886
1 5677574
1 5739066
1 5948862
1 6157975
1 6795316
1 7095402
1 7354509
1 8085171
1 8456584
1 8575812
1 8984392
1 9013472
1 9125765
1 10424220
...

result:

ok 1812 lines

Test #72:

score: 0
Accepted
time: 108ms
memory: 36412kb

input:

1990 1979
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670...

output:

5 6765520
5 7314334
5 7692954
5 8398976
5 8777596
5 9216226
5 9326410
5 9574122
5 9741165
5 10094694
5 10119785
5 10300868
5 10658764
5 10668599
5 10849682
5 11179336
5 11207578
5 11228302
5 11586198
5 11640608
5 11643057
5 11715485
5 11728150
5 11753241
5 12000953
5 12019228
5 12094105
5 12106770
5...

result:

ok 1979 lines

Test #73:

score: 0
Accepted
time: 131ms
memory: 33796kb

input:

1845 1815
439788326 4
290322352 2
986205736 3
710314349 5
685726300 4
853875260 3
971736329 5
438979736 2
886818995 3
172808191 2
420841453 3
510881405 1
431215518 1
199291335 3
467841446 2
683750115 1
257564895 3
202281694 3
826348885 4
385400539 5
217140246 5
456942122 2
41496387 2
829740419 2
751...

output:

5 6933249
5 7333923
5 7431805
5 7539419
5 7832479
5 7940093
5 8545870
5 8709434
5 8817048
5 8965512
5 9110108
5 9217722
5 9315604
5 9346518
5 9366186
5 9464068
5 9571682
5 9716278
5 9747192
5 9823499
5 9845074
5 9864742
5 9952688
5 9972356
5 9985290
5 10007862
5 10115476
5 10245748
5 10263940
5 1032...

result:

ok 1815 lines

Test #74:

score: 0
Accepted
time: 322ms
memory: 33144kb

input:

1802 1975
332342588 41
970441845 11
719381653 37
922576512 16
177275034 23
488255662 35
253050193 10
620786108 18
709863734 1
807506164 26
624934371 19
657679271 33
968188704 17
636677279 17
733619521 22
326275757 37
349557250 21
712026273 39
248279211 24
165404787 7
373691690 23
404033360 30
769815...

output:

42 500827803
42 500922238
42 501122842
42 501601786
42 501696705
42 501802390
42 501896825
42 501897309
42 501991744
42 502291447
42 502385882
42 502419071
42 502498969
42 502533545
42 502534196
42 502586486
42 502588786
42 502593404
42 502671292
42 502734149
42 502789390
42 502794008
42 502828584
4...

result:

ok 1975 lines

Test #75:

score: 0
Accepted
time: 150ms
memory: 34284kb

input:

1873 1802
613474075 936
191550631 1
565168039 1
940922606 1
723793989 1
936250872 1
651398486 1
818818788 1
554633771 1
275490534 936
290775497 1
843102091 1
650604084 1
499561988 1
758111235 1
459142648 1
400436681 1
730320150 1
756878960 1
964498323 1
145557078 936
896291394 1
759694823 936
850781...

output:

923 459262234401
923 459262425406
923 459263980016
923 459265697062
923 459269420095
923 459269840761
923 459270622393
923 459272430378
923 459273175038
923 459273833581
923 459274242400
923 459274938639
923 459275849100
923 459275924374
923 459276244821
923 459276991483
923 459277664706
923 4592780...

result:

ok 1802 lines

Test #76:

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

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #77:

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

input:

2 3
713738007 1
497377109 1

output:

1 497377109
1 713738007
0 0

result:

ok 3 lines

Test #78:

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

input:

47 1830
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
5...

output:

43 19340489859
43 19423796403
43 19575291033
43 19614982748
43 19658597577
43 19682150952
43 19726395713
43 19765457496
43 19786847908
43 19836405037
43 19849783922
43 19919711581
43 19951189059
43 19956643841
43 19961196887
43 20011641254
43 20024576260
43 20034495603
43 20068056806
43 20094947798
...

result:

ok 1830 lines

Extra Test:

score: 0
Extra Test Passed