QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126907#2360. Atomic EnergyKKT89AC ✓20ms3828kbC++141.4kb2023-07-19 09:46:252023-07-19 09:46:27

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 09:46:27]
  • Judged
  • Verdict: AC
  • Time: 20ms
  • Memory: 3828kb
  • [2023-07-19 09:46:25]
  • Submitted

answer

#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <sstream>
#include <utility>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    vector<ll> a(n+1);
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    vector<ll> dp(n*n+1,2e18);
    for(int i=1;i<=n;i++){
        dp[i]=a[i];
    }
    for(int i=n+1;i<=n*n;i++){
        for(int j=1;j<=n;j++){
            dp[i]=min(dp[i],dp[i-j]+dp[j]);
        }
    }
    vector<pair<ll,ll>> v(n);
    for(int i=0;i<n;i++){
        v[i]={a[i+1],i+1};
    }
    sort(v.begin(), v.end(),[&](auto i,auto j){
        return i.first*j.second < i.second *j.first;
    });
    while(q--){
        int x; cin >> x;
        if(x<=n*n){
            printf("%lld\n", dp[x]);
        }
        else{
            ll m=(x-n*n+v[0].second-1)/v[0].second;
            printf("%lld\n",dp[x-m*v[0].second]+v[0].first*m);
        }
    }
}

详细

Test #1:

score: 100
Accepted
time: 13ms
memory: 3796kb

input:

100 100000
707169221 41608301 101586402 393006344 859553265 730023425 98814853 477972519 166309797 232573781 780896817 296557660 462568221 332140093 476440388 929670827 390185874 127825418 549723534 714034592 627159951 447041669 846601260 334545617 610845899 567525566 359169134 492494772 235497283 8...

output:

118920923326875
52998130047243
178071105686731
111669441118187
91495026759275
88535284616411
31399552512779
92318185088219
135708749683739
149738531327691
28886641377883
163969294628123
176941050063595
118728380262907
75612277121611
38466798397003
150840784802283
71090340539963
177278009843611
81319...

result:

ok 100000 lines

Test #2:

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

input:

100 100000
83216558 311342021 834666618 26827227 141705776 972292402 100197503 258845885 375873231 605361458 78128785 819594792 745415022 902893287 574083864 886183243 226055808 898967511 354266739 51543106 336203548 772908911 4241666 114690880 364640639 616765774 328808527 724132561 231395238 30664...

output:

2473781370814
2405711070824
7693416395674
2792911855954
524357699507
1070233166779
5120977694916
7884720642249
6452474018153
7879371080221
7480310050365
2586887722505
2428900971669
4297932531018
3405876130457
1420991216319
7133357711225
3391120430677
5034763467630
7155626725519
5936845121090
3249921...

result:

ok 100000 lines

Test #3:

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

input:

100 100000
720252495 80254397 916783542 987919706 739097879 61953874 869582872 790866496 760711792 418676147 194891484 366531091 439321093 474798375 815306796 14265493 168443716 653569725 873198290 278821588 775460626 597375973 804063736 986755457 296661306 63382144 884913070 870993429 85560901 6234...

output:

68453431270163
27005391629397
67002819457463
10922948400276
53300840663761
41657607143980
26134796166465
65122738479404
20108652683418
56768248861601
70473504335224
16708138849060
32294996877798
4388704151804
61384285146667
43210282425372
60860844746132
71083969967291
18140778851966
67297927984330
7...

result:

ok 100000 lines

Test #4:

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

input:

100 100000
648547317 965894587 885759868 693359762 402443996 184062562 184563438 981524364 78993841 47674990 127112530 991574283 695281690 826763447 420468851 773414670 995835699 558796604 148093836 645285244 513618216 223301174 513885446 561359727 267834997 627673801 295479074 872869092 675134480 2...

output:

207101272136984
167753472199292
135508955022160
5109868657444
240478212259076
170415938676952
125655888667392
94246368500116
254769840538660
6781827841032
238875157727292
188341212338548
4271947282364
17180735492448
8813695699460
100734698800060
223252677349116
236057782407116
68221228257268
7749077...

result:

ok 100000 lines

Test #5:

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

input:

100 100000
388052262 44110393 699723345 658550033 282774011 41614517 21349269 230799512 157660654 98875048 629753532 309211024 796109896 652565050 554756783 465832449 377338718 937750708 173481668 609092345 795999820 171676358 654067427 769744773 94731618 108635234 128396037 113439214 542067702 1539...

output:

14654620659712
52822328847681
15185088773398
56735361007962
8391283443342
13723279482165
37231157358343
22157509848874
26602049395477
41327782182166
58017769966177
20887841264859
36138210276152
61597248346191
18515623810637
20871544808879
18511380601090
913279335685
52619169632659
58173230903524
564...

result:

ok 100000 lines

Test #6:

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

input:

100 100000
656075648 250757659 191508233 384385173 917016030 453318398 894198473 644876776 338767150 134691763 178988830 966806792 277414267 527135893 410957140 834195421 588580207 702602907 910910085 86171721 629968207 416496720 691728540 917778019 271387777 492994617 630306583 40610367 677911081 1...

output:

35690031833465
170848326118835
24440723536385
143910390857560
210335328089040
19672307161500
158931640456330
162552721316235
129274554652150
160919810393145
151169722143060
151392101351640
212143449998555
168553159503715
169545566378155
54271707158935
146243323842745
7828016113555
41316146019420
877...

result:

ok 100000 lines

Test #7:

score: 0
Accepted
time: 17ms
memory: 3736kb

input:

100 100000
83979722 257086488 733689473 646783934 102367709 493286112 857016724 406799665 354662859 971154115 324478136 112679087 90435068 846067158 406489036 812990314 658888729 138899031 768338781 579786463 565953523 526712610 114837248 211799541 771567235 531017997 85269664 220085629 618696276 11...

output:

16606228782013
4963512340140
7467764812277
7078491731347
51732549136119
20041574022105
48679793105805
11444326741454
30078644046056
10729504951490
22327604307524
11090310271521
35612119910107
17006052030762
27992563640100
25378688111993
1327337768508
48261683295156
38418491719856
56994702823421
1004...

result:

ok 100000 lines

Test #8:

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

input:

100 100000
904132088 324951067 489449985 207115714 952567030 254094596 392499238 821937868 624700815 455054449 710757136 991332165 651704902 688649784 734759778 176355702 306427191 961663863 286938123 463861024 962649017 823201254 887849504 86562589 48006226 475971131 39456170 904009232 366425451 93...

output:

132540982996747
66650883997438
13032889480681
109280239500125
22763222884221
108062910439188
91552772592955
9965732858319
82340933850209
93342888744578
116453879409504
124168082913384
128561562635061
27052178252819
47510310244822
139838850257520
144988363230231
10056248956994
38868389639952
15681126...

result:

ok 100000 lines

Test #9:

score: 0
Accepted
time: 20ms
memory: 3796kb

input:

100 100000
132073695 853031365 58500776 245489328 106567174 844125960 916282444 946924685 102688913 192331233 891791794 123159932 336688994 156767647 85856244 833613672 74428876 690098581 764916170 745148817 317716710 156689124 95519194 427441982 282406276 334373499 906866686 464518450 916947793 929...

output:

235244549511364
249964954528533
250625303244606
7716039876499
147660515012136
82043729318960
6819537054358
143153761017784
241347781379820
122628969283960
34644909335295
46559264197778
108975715652842
178504810015811
172480801948722
80848645915128
7565041526089
86806998552792
268613157735282
1722424...

result:

ok 100000 lines

Test #10:

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

input:

100 100000
540656834 757360544 303070893 307118367 538996649 570746613 468817477 830325490 786159158 676730555 357592614 392764772 954936822 361305128 771119695 104106249 53277940 452075191 421071234 111270473 92771508 966051680 860236845 960879439 599490475 144404814 902357748 205545577 191415877 2...

output:

17245717632720
35766830819448
9984908921328
25989171556032
32392641911472
12892689970848
39634382666304
2461942252224
4715387046108
17323033326372
22964417070552
36239540124888
35191441650996
45659650508316
25795385061984
10857845566584
23406430252032
7306358843952
24941433003480
25588622348856
2049...

result:

ok 100000 lines

Test #11:

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

input:

100 100000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100...

output:

10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
10000000000000000
100000000000...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 17ms
memory: 3828kb

input:

100 100000
2000000 2000001 4000000 4000001 6000000 6000001 8000000 8000001 10000000 10000001 12000000 12000001 14000000 14000001 16000000 16000001 18000000 18000001 20000000 20000001 22000000 22000001 24000000 24000001 26000000 26000001 28000000 28000001 30000000 30000001 32000000 32000001 34000000 ...

output:

3180313000002
252768653000002
913830399000001
594759006000001
474530764000002
92494354000001
228604197000001
400298425000002
909106315000002
102476028000001
508169582000001
40454267000002
501718575000001
484995124000002
694689487000001
556099535000002
839319939000001
29855314000001
854120314000002
2...

result:

ok 100000 lines

Test #13:

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

input:

1 1
1
1

output:

1

result:

ok single line: '1'

Test #14:

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

input:

2 2
1 1000000000
1
1000000000

output:

1
1999999998

result:

ok 2 lines

Test #15:

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

input:

28 67981
771266914 962687506 752670752 680250457 387789169 454278920 461464587 402556498 112256864 808980193 544299754 492198169 862010499 433074191 550807434 443784563 343339632 605531542 985427579 730043827 718910027 413151564 981490116 962511396 234351630 435387031 911251022 638448934
849892973
2...

output:

7966952471651395
2684375580261238
4627688159971389
5840396130846042
8074201256336397
5525770581189191
4706677208127908
8613507754001263
9310186316073686
5434096105091939
5059008081209929
9120753678307540
3149712465561985
3019773876745450
8527138656001240
3766460812084208
6186738080597894
60950237299...

result:

ok 67981 lines

Test #16:

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

input:

88 36626
815832519 854734340 56538363 633386269 751953939 74849613 891290362 854588888 507895975 983535844 83909548 498536877 802750257 297840520 62271268 466810178 422156051 241124269 528811364 506749189 176127329 314499747 417089674 762282460 312023665 709174910 760724966 519599271 919964256 97723...

output:

196628374764699
144485012932160
122777586535837
37859009626021
253309117384750
31611400281251
115586570869772
333183758790208
6017831590614
283593847526811
166716983097901
47528668748129
100264359560393
195991414198253
402722725747790
426927317222047
154495830194676
182975919982235
291314970676358
3...

result:

ok 36626 lines

Test #17:

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

input:

100 58712
967899832 188803053 445367448 776718646 822731059 49151322 803517610 337199993 305360944 673392320 853644040 786916118 538508644 758743690 916859138 657247859 872094720 560942954 61996936 948531298 244311971 930913354 193840588 264583861 885432247 808187251 192904952 891062314 940737008 25...

output:

6096902777229
44498614628396
2448358665754
32037913230414
36572725577848
42154181975164
36293144557706
1629890510768
22077272126406
30311248738674
33466408965376
3706360947750
843724682894
20038035564940
9645035609280
25877823848082
20260298529602
41874349072282
43835619379774
21306538157352
3628436...

result:

ok 58712 lines

Test #18:

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

input:

65 37792
71652274 835667570 521117281 354802832 566136613 377951324 1123616 903110740 514251891 687607496 137476865 817773950 533083597 771859258 44290459 356341904 654098346 729416414 806179429 324584276 335328229 417439628 377872531 242032595 155130610 507190914 199888634 758797807 833855250 84368...

output:

2557752025668
31839271678276
58193582004640
117626136053796
127838944447712
118008100320130
39818875476388
151714253489508
144179580278692
137243867082564
132636525386592
14396318518980
97117075276448
87900748928804
33569626304480
101321097849664
140122128039456
91159154250338
114046096593826
403522...

result:

ok 37792 lines

Test #19:

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

input:

100 12625
430316069 685772357 220194359 287289985 401620802 895722720 420905318 123631588 422882394 937682185 515508998 345551545 634195865 681987888 378795024 308080162 540457049 823458330 909107060 455961064 9158847 618332916 742521754 651835678 129706902 742372707 36757552 657372525 597674279 621...

output:

22201980029575
264728793185488
157751579831484
153824379441878
208991462026224
130112259485090
243572918674330
146558526166530
140848032376732
200964773925504
271701538582734
30210186776781
184648133926733
85708639710596
238342403363885
224423992466189
238403636575349
252994735502042
318884502409098...

result:

ok 12625 lines

Test #20:

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

input:

57 47763
622355349 842286489 76405854 589486017 392408631 534842766 41528401 51753874 290818050 79279424 543999721 76471059 569163824 352545765 417871406 850828862 385643831 532089974 645908935 628381076 526077021 495275459 363779385 9030241 654572610 272779783 656854854 427694070 694184309 75306060...

output:

345316923176566
270122658151553
358295524151639
314760875446830
162617693227999
64767100392402
265229936131393
307667520898664
84995950952045
201842194027960
288115307207166
198136825793568
133987237804124
4370178327714
259313049222261
164762082406340
358301064228657
159430884703784
267187537341199
...

result:

ok 47763 lines

Test #21:

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

input:

34 49474
305563619 496115090 443628074 456221698 81673616 868618409 814824312 194049467 708543456 174891653 969772357 65233077 576667105 273509955 801238290 244355963 297295566 867431202 830235270 558376491 554415496 499327304 502894053 110742669 650803160 301455832 374139774 739712324 664442807 114...

output:

278713483545898
438513113112432
306978041879060
851960297431894
1017907939293242
758953515077722
1002641859599072
970629583963157
224567688220863
852191312968848
183146066279376
193646353929546
526391032624613
188318906286086
692786716752640
305467265870683
830897964490477
841639235319567
4318899508...

result:

ok 49474 lines

Test #22:

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

input:

68 51598
370291341 412359239 103244556 385680015 827927699 524585921 574430607 842819652 786498556 564816613 449019487 427195888 809904684 441615854 479244482 794151324 671835177 426957960 685828535 676370731 166147993 750557726 538226474 188226712 461728919 412554053 737097257 455422913 940995194 8...

output:

13971029796397
13552341456596
21373402406122
18584079579594
23180007119943
27096569115684
21705153778591
28432428576067
822661815495
18727877095705
16221417188623
29092751524960
14645743099325
15063050276848
3727426704312
22998947549101
24846565589757
19197373081200
17032155561984
8745803844258
2639...

result:

ok 51598 lines

Test #23:

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

input:

54 50032
883735784 594221908 289456526 679273265 774378206 625337113 630617556 318180344 850098997 705869406 448304577 334121239 338484773 785533851 729113666 424018408 433056086 515637933 517470343 666894273 344365055 770345223 586211962 995066915 571888768 844296468 925751598 886652838 425177821 6...

output:

930761925747682
316554358160348
580711181840048
773389907278758
115972978337062
628981902871874
927515526227808
314775462999206
67767915185533
469051961822332
212311820154938
121999768377836
1128763615875409
60832888704157
787531895559444
314919161331026
963598254214204
555657805049382
8942155118218...

result:

ok 50032 lines

Test #24:

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

input:

31 15182
747854970 759848675 901475677 901070707 488670718 47870030 298775336 956570844 564395109 812715250 89677463 3378454 284178160 16541319 604255202 929319970 708421607 222469406 970172785 989931373 526683245 829796302 77722808 163419054 694018228 472609303 579755357 65736075 59759085 29741120 ...

output:

108092378280146
223836695375730
74521132426943
171919796124066
107440316387422
233276636422940
124059710946273
182266730113347
280589279886336
189884965822632
181296205288066
139859611974743
18982923071275
945172130223
277795730889018
149297222221074
1269544976173
162035389416591
240790035012136
961...

result:

ok 15182 lines

Test #25:

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

input:

15 18182
514764800 710937628 254660969 347117494 205399803 538561973 375305043 350069636 808926767 401897634 230388940 918228201 469162197 801513134 594323083
317083834
620442231
536171332
550220831
550496260
72398734
578794305
573468076
653273075
483854457
336306065
320085254
586490859
386269087
17...

output:

6641146548134726
12994820917913917
11229813430418614
11524072567292438
11529841275961098
1516351927880726
12122528184552066
12010973023721143
13682444925138834
10134065406063217
7043745486050363
6704009407831263
12283728302626297
8090193611718678
3655861814246946
19535552693543403
8347715989343266
6...

result:

ok 18182 lines

Test #26:

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

input:

78 74719
933805459 43176671 416901927 488091665 659094834 548813517 255840537 848739942 66094678 731153265 715262783 546492807 241726345 430066909 248588198 343853689 887991275 212171869 444983451 795813694 982577594 31536427 216595737 151742795 272169321 704630230 298328893 409852007 116030848 1601...

output:

5988675539151
1419935602809
2264810787991
4482646292669
245990253446
4263582351300
3075231736156
4893717565369
4840043420715
964392186681
3365127720099
939231527003
789026082134
1657544503512
2921913598470
4287958730833
2940817087024
4994529995685
76356947604
982352743492
4773530693979
3231901621869...

result:

ok 74719 lines

Test #27:

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

input:

14 66077
535250360 696210885 419414907 438249372 730284755 227558213 94669911 462194151 229990504 212065864 956394053 567259842 106118056 55357119
973072215
678325247
897563250
609665480
402277363
647696377
709654094
984614216
838034875
436958670
667440326
230859641
922700041
850384815
183693819
117...

output:

3847605553898458
2682152420627342
3549037003973404
2410666268747268
1590637023178328
2561043298819150
2806029270709078
3893243418301727
3313656933395383
1727769755781068
2639112396555771
912837649216691
3648429876355185
3362489595544779
726340358820686
463918266925588
1432391728116016
25248306391889...

result:

ok 66077 lines

Test #28:

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

input:

78 8593
715264024 884002440 96862111 908535956 494602474 340710565 723323002 808228243 904300974 495572101 443028330 154405715 608882650 927861330 311543857 670977727 111024596 616366695 465607911 778366831 1068599 80978591 529253698 254131409 237222917 8682768 987923568 406988964 846932854 28610421...

output:

38001357111446
631902958758
46463127247225
29132490168777
28846541380542
34893440337345
3223231223933
48557753702344
24692486035530
44712047081843
44675755188629
48024974396677
39272943549645
38223917994916
2502097740797
3514018167225
9490434234482
26381779830057
42854955224038
1323601267132
1336293...

result:

ok 8593 lines

Test #29:

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

input:

65 66353
649909603 506097183 284994716 211143281 279699501 846252048 688423149 848232551 621333023 539071798 633912904 457540954 494206626 103865380 402134346 525169385 249128269 496816513 90163179 375675297 472272422 999848950 655449563 838007734 665280415 231789713 84203525 358611632 39145096 1744...

output:

148396720940678
77068060518049
413837772637206
61282003611800
362867125980975
411512013886540
132352593899918
131174782906103
333224104802985
294087343311875
17930402152119
132431751235420
312031150785932
260012342025775
450082087365258
501061779756979
247993894969323
251525046067313
198260767794788...

result:

ok 66353 lines

Test #30:

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

input:

27 78508
398210157 949083772 14034914 461601619 748568169 388591621 239960136 807969958 710811120 249531202 744035664 448685427 374536645 291688677 159456838 313036454 340039682 311529466 157162154 132200215 725887891 104984332 681523986 829791336 553328129 942705475 473109336
46457341
300549004
386...

output:

217341603447742
1406059816221736
181029597042340
2524480386834864
3724097587789506
3318117195330152
2852119012139338
3798846550569592
1100374666830698
3348679069954972
1101319806009286
4469889584427458
2864205185625418
113749075708862
774421753716870
2380866382260594
1374815564633282
264944686137333...

result:

ok 78508 lines

Test #31:

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

input:

28 19878
961834584 94986430 806068965 604597260 939088126 144762090 673596832 537096375 35631313 826716369 183540550 798170235 685886850 68600489 760740687 545455581 963601433 690505939 477401065 671434411 475038987 942765320 586372049 535889317 446705241 386626276 342089083 227438804
8838542
506313...

output:

34992238096684
2004513519392342
3640112935557580
2210330784892455
904891931843279
3059165712262656
912191554091709
3506759725979886
2657864659301147
1735818396453800
1877800032159907
3379701912072836
2142406021045258
1169154634324971
2756555705271813
2940726616794061
1068238407533181
129295937529347...

result:

ok 19878 lines

Test #32:

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

input:

87 56221
219059441 138825948 611379268 823543090 297590613 981813718 860150568 872892768 459703405 891627205 235297991 591388874 573267504 74479303 539317604 11162781 497476917 314468481 656574653 718206369 414152197 588337000 983602362 327058064 792071713 458493911 715878490 950946411 17033866 7082...

output:

234299322989368
212603043709397
124883525851938
206710580485789
196467104995398
95177450855120
241165701965485
235412703768989
106484699040685
169968456763077
184638664616031
198276531096575
129833226781772
58353343599372
161590598048887
161276008306492
194947976124943
39902296005953
247797609248864...

result:

ok 56221 lines

Test #33:

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

input:

8 35442
104483639 241781519 441699091 177654376 637111584 505013443 58575496 81697074
817209919
141346960
603215706
120074763
178608907
973047754
978038013
481781411
983130846
624801550
440062730
63539977
255148656
931854534
802349414
557814366
510462912
450595236
150629722
228619252
388868410
90291...

output:

6838353777831482
1182781272820780
5047665625784468
1004777030415664
1494586488688346
8142393546033712
8184151688800714
4031512247508308
8226768207675338
5228294414195700
3682413269630740
531698011672256
2135065582704768
7797691676492852
6714002215716092
4667750511068248
4271516909039986
377054849199...

result:

ok 35442 lines

Test #34:

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

input:

28 58953
708511374 567734770 816590432 698112336 425071434 522366557 299888214 361357969 170398890 471853811 210194945 88466534 10943525 379658288 229801929 840674718 361705288 905420085 462891442 827824159 765376143 861865835 712893481 627610231 136974909 568492516 408303553 963064919
91794478
5521...

output:

77273825243736
464787583357188
148421931765783
243508302622598
507411344701622
533099189837174
48930942168372
816277628810688
489970270038963
65036864794973
117445780851133
721218701949399
443387016817538
541479866358459
797411802449872
146934711415793
19154446516584
203154238566986
88304564136006
9...

result:

ok 58953 lines