QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#67102#5099. 朝圣道cmll02100 ✓4015ms14660kbC++143.7kb2022-12-10 09:06:332022-12-10 09:06:34

詳細信息

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 492ms
memory: 11876kb

input:

1 910276 554767
6
10
7
4
10
12
9
3
3
5
7
10
5
6
1
6
3
9
6
8
12
11
8
2
12
5
9
3
8
2
12
11
2
3
4
9
2
5
5
11
6
4
8
11
3
9
2
2
8
9
2
8
9
6
2
9
2
10
10
7
5
6
4
4
11
12
8
8
2
2
4
3
3
5
6
6
8
11
6
9
9
3
4
1
2
2
6
9
9
2
3
2
12
6
1
7
2
4
12
11
4
7
6
3
9
4
6
5
3
3
12
6
2
1
1
7
2
6
5
9
11
6
3
4
11
1
2
4
5
4
10...

output:

5419
364275
514407
329394
364275
229662
53120
520095
520095
509260
514407
364275
509260
5419
277384
5419
520095
53120
5419
115262
229662
243797
115262
416076
229662
509260
53120
520095
115262
416076
229662
243797
416076
520095
329394
53120
416076
509260
509260
243797
5419
329394
115262
243797
520095...

result:

ok 910276 numbers

Test #2:

score: 0
Accepted
time: 1644ms
memory: 7456kb

input:

1 972231 293475
7
1
9
6
5
1
11
5
5
12
2
2
7
3
4
10
10
3
2
10
7
1
10
9
1
3
5
6
7
2
7
4
1
10
1
9
3
10
10
2
6
11
4
10
12
8
5
2
12
4
9
12
7
2
12
4
3
1
2
9
12
1
4
5
6
12
6
5
9
2
5
12
3
4
6
12
12
2
1
6
4
12
10
5
12
7
9
8
3
8
10
5
3
6
12
7
7
10
7
10
8
7
7
2
2
4
8
6
10
8
11
6
11
10
3
9
5
2
5
1
10
2
11
4
4
3...

output:

117936
146738
29445
289464
209790
146738
240513
209790
209790
158067
220107
220107
117936
201765
284305
145210
145210
201765
220107
145210
117936
146738
145210
29445
146738
201765
209790
289464
117936
220107
117936
284305
146738
145210
146738
29445
201765
145210
145210
220107
289464
240513
284305
14...

result:

ok 972231 numbers

Subtask #2:

score: 8
Accepted

Dependency #1:

100%
Accepted

Test #3:

score: 8
Accepted
time: 761ms
memory: 10456kb

input:

2 957481 386233
816
1256
2812
1370
1469
1439
33
929
1437
2680
1001
1846
1936
1161
1823
1417
2823
1753
2434
577
1671
676
174
2401
1762
123
785
604
1650
117
2344
1365
221
1096
1087
1057
457
2254
647
1827
266
1599
1445
83
2685
1372
1795
2595
1909
2605
1608
2656
1114
581
725
725
2964
1893
2997
2159
2457...

output:

243553
369562
36625
90220
62730
42787
241717
149359
268969
155264
320512
294338
253353
21209
383147
351989
377945
95957
11104
281882
322211
249147
314632
233795
328009
379666
87737
25996
373808
370185
100320
276912
381027
160702
232305
93658
378209
290139
141008
290287
259740
247075
57683
258680
366...

result:

ok 957481 numbers

Test #4:

score: 0
Accepted
time: 2141ms
memory: 7612kb

input:

2 912746 991287
2945
439
558
2022
1589
2495
2517
2291
2215
160
319
1671
2800
2008
2885
29
41
580
1156
2553
1876
1137
2129
2338
1046
1818
2691
1454
1229
1965
635
1516
987
1629
140
2320
1715
2644
452
1353
2755
693
956
2518
1154
2441
946
137
496
786
2489
1509
190
2177
1216
1725
480
2572
1774
2465
298
2...

output:

660858
612612
0
511632
911772
0
0
0
92378
55539
511632
0
0
0
479655
660858
939807
894102
95931
260865
699732
0
583110
496485
0
630819
0
90117
116622
804474
466488
816354
174933
450585
988218
623007
0
208692
0
0
330429
0
758043
660858
95931
660858
0
138321
148614
208692
0
692478
277134
127908
831402
...

result:

ok 912746 numbers

Subtask #3:

score: 12
Accepted

Test #5:

score: 12
Accepted
time: 9ms
memory: 8032kb

input:

3 1 334547
8234

output:

179079

result:

ok 1 number(s): "179079"

Subtask #4:

score: 18
Accepted

Dependency #3:

100%
Accepted

Test #6:

score: 18
Accepted
time: 981ms
memory: 12144kb

input:

4 1000000 581873
49881
62491
206405
26106
129239
174098
141494
61402
149825
241992
8109
243567
71918
203927
278575
263516
143582
32237
195508
269119
9111
105700
80919
229859
150334
171917
78447
62500
190063
138903
6395
222902
118653
136505
242467
64984
170330
287622
27089
35823
107672
273459
188857
...

output:

225562
278095
494263
533616
449513
172629
433105
169217
156602
470240
127840
224903
148625
143635
385698
428034
270424
224704
326598
317786
205590
556103
563899
492571
87003
417735
350849
476300
65308
462020
373541
56205
35476
425631
345156
395965
377993
402141
119653
299737
4555
400632
420936
58015...

result:

ok 1000000 numbers

Subtask #5:

score: 14
Accepted

Dependency #4:

100%
Accepted

Test #7:

score: 14
Accepted
time: 1692ms
memory: 13992kb

input:

5 1000000 840643
596357868225427095
792903040511847841
549819683428503148
982786835970534376
855138540813992974
101968907510306081
885121351101383723
127972727417081251
728407510651610501
998897446686193527
889398142082696651
17276066104970301
87773104284997915
716559595019194816
538865162230963483
...

output:

0
149057
0
0
0
0
13853
0
0
0
618602
0
0
0
0
0
243219
264897
0
0
0
0
0
0
0
0
0
0
0
0
311655
0
0
0
670015
171419
0
0
0
0
0
0
0
0
763198
247491
0
0
0
0
0
0
0
0
0
0
0
513609
0
0
0
0
0
0
0
0
0
0
0
0
0
0
37092
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
720992
0
0
456272
0
0
0
0
0
210850
0
0
0
0
0
383431
0
0
...

result:

ok 1000000 numbers

Subtask #6:

score: 12
Accepted

Test #8:

score: 12
Accepted
time: 2168ms
memory: 8020kb

input:

6 958477 522361
280121915553826833
734266539148641647
72849162479700582
274266741463686096
60278972064195458
828423669427600612
571432949203039978
518511460268700898
486268614705621285
19216283231217074
611458416727512530
175147354285288662
799769622289998997
400123443628688299
145546980862133838
40...

output:

0
0
0
0
0
0
0
0
0
0
0
193620
0
0
0
138180
0
0
0
0
0
264460
0
0
0
0
0
458514
0
0
0
0
0
0
0
0
0
144011
0
516922
0
0
0
471569
0
189623
0
0
0
0
0
0
0
0
0
0
324506
466417
0
0
0
0
0
0
0
0
0
0
485170
0
0
512806
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
189161
0
0
0
191079
0
0
0
0
0
0
0
0
0
0
0
421120
0
0
0
0
0
0
0
0...

result:

ok 958477 numbers

Test #9:

score: 0
Accepted
time: 2732ms
memory: 7620kb

input:

6 955832 455871
68195868797525446
952386767279138889
842103266292995505
840751519399679445
381478477655923549
435500089497041045
90996577129314500
835530589245892594
335186020054452993
368796095079538576
343648428400752269
149581187007562672
361932544298643774
852760910071550430
334542588842244106
1...

output:

0
0
0
0
0
0
0
0
0
0
0
357474
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
388596
0
0
0
0
0
0
0
0
0
0
221520
0
0
0
259467
144495
0
0
0
0
0
0
0
0
0
280605
0
0
0
0
0
0
0
0
0
0
0
0
443508
0
0
0
110058
0
0
0
40755
0
0
0
0
0
0
128739
0
0
0
0
343980
0
0
269217
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
232...

result:

ok 955832 numbers

Test #10:

score: 0
Accepted
time: 3029ms
memory: 7328kb

input:

6 920503 912855
88854105048350343
546112848827260402
742717887751570826
418466162813744610
797678872098106952
493045003614157270
451253512773300132
717835601730297063
267208617798003964
402714391488996741
621637146773131192
29530591296095815
184304713337874667
838560329686261006
723100972616202037
7...

output:

0
0
0
0
0
673740
0
829635
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
106875
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
900315
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
260775
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
83505
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 920503 numbers

Test #11:

score: 0
Accepted
time: 3672ms
memory: 7376kb

input:

6 992811 237237
351964107346233004
447943076232529897
336764658006054345
607057933835452300
454899480599354305
364176615667113177
218851297210261766
108812790106497700
965269456843322614
476081318664366175
614994445139752884
298448164484316273
118553993784636985
44291697037334257
39465300589188716
4...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 992811 numbers

Test #12:

score: 0
Accepted
time: 4015ms
memory: 7520kb

input:

6 958483 973245
900270435752667109
527638004327331947
400218523121137716
711605652944982158
111329498983197239
374886535322734020
351759265981262460
923352917061464459
670493172832470698
615067639000107688
273698785908817494
187426602045325921
814683800644030943
754134172664791067
332473394086970946...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 958483 numbers

Subtask #7:

score: 8
Accepted

Dependency #3:

100%
Accepted

Test #13:

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

input:

7 1 731039
314313205082038759

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

7 1 587945
675184352277027016

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

7 1 732151
522404464427087971

output:

0

result:

ok 1 number(s): "0"

Test #16:

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

input:

7 1 952025
865782493150981281

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

7 1 151005
80048698775676684

output:

0

result:

ok 1 number(s): "0"

Test #18:

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

input:

7 1 819153
214538328031265195

output:

0

result:

ok 1 number(s): "0"

Test #19:

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

input:

7 1 84501
605460166753167761

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

7 1 579977
434091105518396762

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

7 1 161075
649828935660369724

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

7 1 629595
216539117331686464

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

7 1 317005
831315176686118434

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

7 1 204399
934354294367869212

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

7 1 98233
515248809013032256

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

7 1 738315
930635383520033839

output:

51840

result:

ok 1 number(s): "51840"

Test #27:

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

input:

7 1 404535
557582195171952455

output:

0

result:

ok 1 number(s): "0"

Test #28:

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

input:

7 1 277475
413241759909529359

output:

0

result:

ok 1 number(s): "0"

Test #29:

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

input:

7 1 206409
381910309127041513

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 16ms
memory: 10912kb

input:

7 1 694649
641706538274033333

output:

0

result:

ok 1 number(s): "0"

Test #31:

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

input:

7 1 974065
700551256691343002

output:

0

result:

ok 1 number(s): "0"

Test #32:

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

input:

7 1 966571
5339566589982367

output:

0

result:

ok 1 number(s): "0"

Subtask #8:

score: 16
Accepted

Test #33:

score: 16
Accepted
time: 15ms
memory: 5472kb

input:

8 9963 251
831797004675585320
494759973681332858
701341496127272302
252910460485222469
250965009655458584
366193481309061299
633134388675839346
791999098066205672
196620805863610860
363773642045280947
466508590762410710
407790578717064135
181590911404670570
570642047249889864
70138464625729452
23634...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
204
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
63
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9963 numbers

Test #34:

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

input:

8 9967 6043
820328543276206812
181987384710842549
607221769552657162
341958396909446562
323372299362111304
912735937493462137
261510727281638358
792961465908198578
724729139273707925
61144688983588693
803871679975888144
565482268842659147
653581946336745517
701605486107526593
237425098688490866
3911...

output:

0
0
0
4601
3550
0
0
0
0
0
0
0
4890
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1943
0
0
0
3598
0
5239
0
2888
0
0
0
3581
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4367
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1295
0
4008
0
0
0
5375
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9967 numbers

Test #35:

score: 0
Accepted
time: 25ms
memory: 5500kb

input:

8 9958 7341
246592510376086877
843442167129623384
163968090028533751
786994286411665724
810314145468625407
382997160361312553
621227536566512389
782654969130405492
662775335088395473
723417297592011109
102999527027241303
490566704238479035
460383429537079806
770514075045815286
862086443272202320
491...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1875
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4701
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3846
0
0
0
3225
0
2001
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9958 numbers

Test #36:

score: 0
Accepted
time: 19ms
memory: 5588kb

input:

8 9995 6385
923142108771350737
257950038453679451
536185509148236859
123994810398239828
655641306130430676
720060704445331255
100185112829379915
969736120911358569
88295557636108209
985229226008732676
121012502328734425
208637791506917285
465480660767217532
270404172746200856
188217877755686220
8611...

output:

0
0
0
0
0
0
0
0
0
0
0
0
3365
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6290
4175
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5460
0
0
0
0
0
0
0
3270
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9995 numbers

Test #37:

score: 0
Accepted
time: 11ms
memory: 5432kb

input:

8 9986 173
616350028627206083
373618134733377525
511700823897700555
242227241128829686
514868167357355607
397500099089111965
358047306663207071
864963899222887428
441742103082050692
79747708146834517
193279633511836619
455494397124008884
290304986099763677
192943969860115773
999569762267228801
51519...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
121
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
139
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9986 numbers

Test #38:

score: 0
Accepted
time: 24ms
memory: 5508kb

input:

8 9922 3815
980134735794669132
340451576512629641
916261323337020513
961588450139733298
606890924942839243
604420709399644601
559517946721716851
536700142889319911
331110861404036875
371230996480430738
574124765433697807
506302435162527428
52794550999031066
927328113430744153
891630507895187405
2415...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2730
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9922 numbers

Test #39:

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

input:

8 9921 7545
84307725194286651
875239149408876992
764783773180591937
695879634385962619
812182005507271555
608328282234108083
301758663052025733
511628080822487181
276931834242496785
509220340102936075
961667521409256800
874525335129851843
368294539474902706
73765674400326403
37830957992997285
315147...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
75
0
0
0
0
0
0
4305
0
0
2535
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
195
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9921 numbers

Test #40:

score: 0
Accepted
time: 21ms
memory: 5456kb

input:

8 9952 7357
224766152006290767
472480143124120628
191863347926658903
749444983273484702
7260615477914965
260862181156223569
288726169100135869
940760523335181321
604250633147606021
933133954718742400
695601019212574678
673050554223660673
607021343602215395
669832485551539178
853955876448054742
64822...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1337
0
0
0
0
0
0
0
0
2590
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1463
0
0
0
0
0
0
0
0
0
0...

result:

ok 9952 numbers

Test #41:

score: 0
Accepted
time: 23ms
memory: 5440kb

input:

8 9964 7135
828538342263222786
373021611609716674
79938886687698695
36132372667558654
514677924786213726
481129347348919061
140527838258218819
58146584406210174
735896530635868722
419610580516772759
962841512556863078
565618117240702777
786445523170830699
246235334522727834
35415921722589846
5394601...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3610
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4930
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1935...

result:

ok 9964 numbers

Test #42:

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

input:

8 9979 8745
725034740662684938
405429699248793690
485494472420218098
935359060622766351
54775653102112806
329352051104979909
602583900805321870
56411817802250529
972873270657787432
398644445686915691
941779835546089793
193150681056822101
478020269547157778
953450049487365905
443834652742237895
15378...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9979 numbers

Test #43:

score: 0
Accepted
time: 25ms
memory: 5504kb

input:

8 9966 2343
24937597121290466
290972337658876277
543511157343240183
442568325503258648
998216986952187757
835024136728339087
416485393615188569
429745417591258534
664425233729693692
218020416210383084
288505744860459316
632584473979288964
692757888148446943
407374998807512565
317249142497688254
7953...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9966 numbers

Test #44:

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

input:

8 9920 7035
190746627251475452
61143926689671428
776066209067863963
904378922365391840
484694428575386948
508625347060077571
311415677276324964
541954236774698788
423529167291285977
860263733758421783
924066001943130319
760857568832192499
751010219819144685
935475775240480817
65390773463860518
95520...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9920 numbers

Test #45:

score: 0
Accepted
time: 25ms
memory: 5436kb

input:

8 9901 3459
971506300495980541
449584711509930435
865623287404961452
531804090039590835
416539167212644034
732686100618982140
917166327452382276
488329727463142582
208056968914009358
889018144671117938
161221554990149781
115470820867546621
376032901887570485
454639335933228465
265533427620368919
703...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2175
0
0
0
0
0
879
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
84
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1338
0
0
0
0
0
0
0
0
120
0
0
0
0
0
0
0
873
0
0
2253
0
0
0
0
0
0
0
0
0
0
0
717
0
0
0
0
0
0
0
0
1500
0
0...

result:

ok 9901 numbers

Test #46:

score: 0
Accepted
time: 24ms
memory: 3480kb

input:

8 9922 1341
620568044946579161
94959636611894647
126088360550918436
435592416807086669
148386281934389750
232227818066506451
316223661052775274
692689041297777204
590898248939031159
734695917081072534
892063067998582189
212620799448817154
285832707337918773
588493336321841757
87593957369421071
55596...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9922 numbers

Subtask #9:

score: 8
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #47:

score: 8
Accepted
time: 2522ms
memory: 7668kb

input:

9 993113 539919
966292090646064980
400839598671623984
890697905178072382
359739241565296198
178841735307850997
42545474793765705
188248326880460914
832145811117144414
178212470930935375
552687240609124848
289212522891989026
517485426974354658
585748207646148107
476739723135877033
868219024526058530
...

output:

0
0
0
0
0
0
0
0
0
76599
0
0
0
0
0
0
0
0
0
0
0
160272
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
45954
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
444312
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
287172
0
0
0
0
0
0
0
496017
0
0
0
0
0
0
0
0
0
0
0
0
0
373788
0
0
0
403488
...

result:

ok 993113 numbers

Test #48:

score: 0
Accepted
time: 2341ms
memory: 7608kb

input:

9 992903 332905
200831150786789623
860034811499659461
669456978521938397
436994204002148866
338591433609549440
505168122769906941
736703981725178303
311514007711832700
780037687957549835
393813188047150668
355884940700327528
629531439531983959
187061455472561673
272555127376409616
959772673178107448...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
285645
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
234710
0
0
0
0
169580
0
0
174835
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
124405
0
0
0
0
0
0
0
0
0
0...

result:

ok 992903 numbers

Test #49:

score: 0
Accepted
time: 1658ms
memory: 12096kb

input:

9 996116 596363
72495086929656695
933213205576111503
102582489428312149
819384598966609294
637380671502936489
325942467053290108
658518083930793698
781391541437932861
554497794039551183
340538381786261498
990313726248083873
690479151352674474
452152055403145024
459487518914134878
694182062329525940
...

output:

0
0
0
0
434012
0
0
0
0
0
0
424359
84705
0
0
351446
0
534852
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
22733
0
0
0
0
115159
0
0
37605
0
0
552174
0
0
0
0
0
0
0
0
399271
0
0
0
572397
588904
0
0
0
414379
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
38069
0
350966
0
0
0
0
0
0
0
0
0
0
76044
0...

result:

ok 996116 numbers

Test #50:

score: 0
Accepted
time: 2651ms
memory: 7564kb

input:

9 996973 442985
173862356526854187
895464528254708165
962579839118141200
169485920737780129
209515250113517521
617612108498982147
780805748888042036
435167943590980546
97624536181737351
835504461909000974
505924149814627302
400564470827498589
414958643231846129
350462776154050109
685052767509149527
...

output:

0
49590
0
0
0
0
0
128345
159315
0
0
0
0
84265
0
0
0
0
0
0
275025
0
0
0
0
0
393965
0
0
0
0
0
0
0
0
146965
0
241015
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
215175
0
0
0
0
0
0
272080
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
332215
0
91295
0
0
0
0
0
0
0
0...

result:

ok 996973 numbers

Test #51:

score: 0
Accepted
time: 1863ms
memory: 7624kb

input:

9 998601 687469
799136803918631128
295858099080063499
408161517616902618
134221306639277549
916524526879345683
375755821417429018
723406912502459886
479405668075710330
871177537782444652
394406658445200145
950201401404213657
486100750786510967
595638122099550491
466470580383056376
45068876336864344
...

output:

0
122106
0
0
0
0
0
0
0
0
0
0
224754
432588
0
0
0
140107
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
243648
0
0
0
0
0
0
0
0
74072
0
0
0
0
0
498200
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
327543
0
0
235000
264046
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
332478
0
0
0
0
0
288909
0
0
0
0
0
0
0
0
394424
0
0
0
0
0
0
...

result:

ok 998601 numbers

Test #52:

score: 0
Accepted
time: 1689ms
memory: 14660kb

input:

9 994947 925073
550069639746571467
959720729965073146
493111236621060118
845592283489559999
642483244714545950
626658087972561416
223534097740128606
464878348829199542
745959615700594898
737549510688165175
831118864447948925
960978250479628835
714615808809902186
418487616036255189
607495625282378776...

output:

0
0
0
0
0
0
596262
0
0
0
238269
0
0
0
0
126117
0
0
750242
0
632032
0
0
0
0
0
10755
0
0
0
0
0
0
302452
0
762392
0
0
345954
0
0
0
0
0
847360
0
0
0
0
0
0
0
0
0
306627
0
171116
0
0
317013
0
0
0
0
0
744355
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
907509
0
484009
0
0
51795
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 994947 numbers

Test #53:

score: 0
Accepted
time: 1617ms
memory: 9668kb

input:

9 992400 273653
900122048949017572
8180764371283349
944898259501069046
139251199264669609
597508314091810897
859612031686952281
900841413030212610
630668075045561321
202490356593632030
483600875109180751
652082503097031376
5832388696994239
259823228971436352
40978886138330942
496920595794871890
7943...

output:

0
0
0
0
46613
0
0
0
0
0
0
0
0
0
137823
0
0
0
0
0
0
255187
0
0
0
0
0
0
0
120467
0
209477
0
0
0
0
0
0
0
0
0
0
0
19895
101317
0
0
0
0
205244
0
0
0
67814
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
176912
0
232574
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
259680
0
0
0
102885
0
0
0
0
0
0
0
225105
0
0
217307
0
0
55545
0
0
85...

result:

ok 992400 numbers

Test #54:

score: 0
Accepted
time: 1687ms
memory: 9784kb

input:

9 994433 279731
805370922502047760
331967951822138072
331808688699399971
311616680233349641
917028611947209375
727689386923628383
89677895673079581
577564855021170646
520845295988216139
337782338994336158
889631850823594201
415166294801160185
8784481093250770
680656422097429465
622820922020585257
45...

output:

0
0
132528
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
219053
260774
164218
0
0
0
0
0
0
0
0
0
113819
0
0
0
0
0
0
0
0
0
0
0
0
175627
0
0
0
0
0
0
18697
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
258119
0
0
0
0
0
0
0
0
0
0
0
259382
0
0
49336
140442
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
33117
0
0
0
0
0
0...

result:

ok 994433 numbers

Test #55:

score: 0
Accepted
time: 2212ms
memory: 7660kb

input:

9 998277 414293
398783752742116348
761298270151101957
187399996905168259
210143735262607856
974195539801446188
994963266570050593
62254374662744012
116836099886950047
100514812440529269
722491893022228314
994591984547715233
681568411565279941
622009548667378341
945841151420824254
501050038198442151
...

output:

0
0
0
398717
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
40590
0
0
0
0
0
0
229768
327448
0
0
0
0
0
0
0
181951
0
84612
0
0
0
0
0
0
0
0
0
0
0
338602
269126
0
0
0
0
0
185372
0
0
0
0
0
0
0
0
0
70367
0
0
0
0
0
0
0
61644
173954
0
0
0
0
0
0
310244
0
0
0
0
251625
0
0
0
0
0
0
306636
0
0
132407
0
0
1342
0
0
0
0
21232...

result:

ok 998277 numbers

Test #56:

score: 0
Accepted
time: 2529ms
memory: 7472kb

input:

9 997678 36925
116190830988215991
458937163654350842
63842600797853340
201017501337692238
38494692223199743
820842760907116902
592092538971799866
467845477849327645
787624543176560547
157804511271085168
20674609945942423
467484497450473395
656736978949299033
12282630768751247
404423323647435293
7332...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 997678 numbers

Test #57:

score: 0
Accepted
time: 1775ms
memory: 14352kb

input:

9 996257 882577
975630752133927938
286799724598730407
182294845240675407
177122418927174362
263734237377594785
971360628447425136
416292171339205279
862835633202115040
706190198461745186
861402985887871390
857071299303024356
196835527312483646
703719525246731316
939172253853779321
719954852050089569...

output:

404622
226340
0
0
0
871302
0
0
0
0
0
0
0
0
0
0
0
275967
0
0
0
0
0
647680
0
0
0
0
0
0
0
0
692882
0
0
0
0
0
0
0
0
71659
825632
310600
0
0
802649
0
0
0
0
0
0
0
0
528064
727712
596677
0
0
0
0
0
0
0
0
0
340466
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
878589
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1977...

result:

ok 996257 numbers

Test #58:

score: 0
Accepted
time: 3237ms
memory: 7460kb

input:

9 998447 766005
125143104830056419
225198101609772750
77924023737936777
970287281849024915
834929357605040334
446743709806726863
831393397282782907
279545572924812379
925243832352726929
774107632711807781
926979839400437632
295648111027327365
211294901272732552
471391037932458314
596314317613729293
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
183975
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
612135
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 998447 numbers

Test #59:

score: 0
Accepted
time: 1692ms
memory: 7480kb

input:

9 991652 296869
431169498228806957
956749155105789683
890015246714255863
537016863147884656
743882131794299981
260518983837069077
630426469144383568
962959517802602792
190247494992482563
909215262395993742
455619856341064846
74561677329453683
319005527552345792
521215785403571721
997954260745099413
...

output:

0
0
0
0
0
0
0
0
203541
0
0
0
0
0
0
0
0
0
0
0
0
0
52190
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
269546
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
98634
0
0
0
0
0
0
0
0
0
0
0
217049
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 991652 numbers

Test #60:

score: 0
Accepted
time: 2316ms
memory: 7572kb

input:

9 993562 264535
678379587460300011
975957410211844824
874085419642117691
653575478214728818
958272060991778618
423384063128883904
753232945106799987
333254499719222003
717159221834451844
863143849975371113
822366538500418716
71903561662206138
251371207438180093
680567611868221842
801686589810097449
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
227290
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
261765
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 993562 numbers