QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#461317#8482. Driving License ExamLynkcat#AC ✓215ms44372kbC++142.4kb2024-07-02 17:52:072024-07-02 17:52:07

Judging History

This is the latest submission verdict.

  • [2024-07-02 17:52:07]
  • Judged
  • Verdict: AC
  • Time: 215ms
  • Memory: 44372kb
  • [2024-07-02 17:52:07]
  • Submitted

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N 
using namespace std;
const int N=200005;
int a[N],b[N];
struct node
{
    int l,r,f[2][2];
    node()
    {
        l=r=0;
        memset(f,-0x3f,sizeof(f));
    }
}tr[N<<2],ans;
int n,q;
int bl;
node merge(node x,node y)
{
    node res;
    res.l=x.l,res.r=y.r;
    for (int i=0;i<2;i++)
        for (int j=0;j<2;j++)
        {
            res.f[i][j]=max(res.f[i][j],max(x.f[i][0],x.f[i][1])+max(y.f[0][j],y.f[1][j]));
            res.f[i][j]=max(res.f[i][j],x.f[i][0]+y.f[0][j]+b[x.r]);
        }
    return res;
}
void update(int k,int l,int r,int L)
{
    if (l==r)
    {
        tr[k].l=tr[k].r=L;
        tr[k].f[0][0]=-a[l];
        tr[k].f[0][1]=tr[k].f[1][0]=-inf;
        tr[k].f[1][1]=0;
        return;
    }
    int mid=l+(r-l)/2;
    if (L<=mid) update(k<<1,l,mid,L);
    else update(k<<1|1,mid+1,r,L);
    tr[k]=merge(tr[k<<1],tr[k<<1|1]);
}
void query(int k,int l,int r,int L,int R)
{
    if (L<=l&&r<=R)
    {
        if (!bl) ans=tr[k],bl=1;
        else ans=merge(ans,tr[k]);
        return;
    }
    int mid=l+(r-l)/2;
    if (L<=mid) query(k<<1,l,mid,L,R);
    if (R>mid)query(k<<1|1,mid+1,r,L,R);
}
void BellaKira()
{
    cin>>n>>q;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    for (int i=1;i<n;i++)
        cin>>b[i];
    for (int i=1;i<=n;i++) update(1,1,n,i);
    while (q--)
    {
        int op;
        cin>>op;
        if (op==1)
        {
            int x,y;
            cin>>x>>y;
            a[x]=y;
            update(1,1,n,x);
        } else
        if (op==2)
        {
            int x,y;
            cin>>x>>y;b[x]=y;
            update(1,1,n,x);
        }
        else 
        if (op==3)
        {
            bl=0;
            int l,r,x;
            cin>>l>>r>>x;
            query(1,1,n,l,r);
            int res=-inf;
            for (int i=0;i<2;i++)
                for (int j=0;j<2;j++)
                    res=max(res,ans.f[i][j]+(i==0&&j==0)*x);
            cout<<res<<'\n';
        }
    }

}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 44172kb

input:

6 7
5 9 5 1 9 5
4 8 10 4 5
3 1 6 12
3 4 6 5
2 4 1
1 6 3
3 4 6 5
1 2 3
3 2 3 6

output:

9
0
1
6

result:

ok 4 number(s): "9 0 1 6"

Test #2:

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

input:

100 100
503124819 953187887 251879034 392237153 655377475 261398171 801624725 394733711 626653667 763667352 879423992 711101215 367785718 386858304 194636443 605959084 176293318 41565904 782117945 842868534 871633568 102660395 176550610 961765538 813409878 166144856 699532072 364243256 493105851 123...

output:

2963237411
2043908188
3365302015
502330233
5478010897
962135510
2835721383
2535572357
907819888
2570320669
5192444622
5244481856
0
5976968198
4063678014
603543687
1393964776
5252353598
0
0
2933923
2388582093
3050580786
161497175
4742455731
299880562
0
1791966451
2388582093
635929717
1206940576
21228...

result:

ok 42 numbers

Test #3:

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

input:

100 100
386240947 821704027 990883780 122899334 634726729 805876948 826364004 737917699 552620526 191195726 848651728 32469471 10618512 411684737 266863662 683407001 14830641 341037654 655548668 282132775 18697317 872551277 691658119 328864113 540756439 36455064 707593589 89892309 76628676 15328606 ...

output:

5319446518
5386086041
4462809977
4502427964
3167752453
1160598243
1386449247
2740191471
3423380640
260635238
319539153
2120994637
2016464913
0
1128058875
7401886872
3510688237
3311836605
0
3277658026
1464162086
2192373412
3664851292
2034987896
4669130344
1961539387
960312860
6765670869
698098262
464...

result:

ok 31 numbers

Test #4:

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

input:

100 100
564324371 395252872 289697037 148528812 468851791 790547213 406392883 81101687 773554682 473499908 227944871 88996510 948418603 436511170 783801281 465887622 298078363 495285212 823946686 721397016 870793769 492699055 61541436 550738497 563070296 761541080 420687810 965284466 100342988 20259...

output:

442961803
1846263295
2529756004
2345776059
0
0
340058362
852894385
2057983709
590728569
1157837743
0
2695702605
3525702123
56082847
1524729837
1361289177
349807525
3945701339
471125421
1189809541
461428692
337240981
1395429960
255808273
2319178092
1339872413
27726592
1741281364

result:

ok 29 numbers

Test #5:

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

input:

100 100
447440499 968801716 883477591 24415185 448201044 335025990 136164866 129318379 849264645 755804091 902205311 850556254 181185989 611080707 856028500 688559731 581326085 354565475 992344704 720469769 163081710 112846833 281681650 67580176 585384153 631851289 133782031 250742031 273800404 9496...

output:

1202796287
3267926173
486627720
592707658
1588942283
2188292911
2550373998
3935112193
1964588006
0
1214806867
1385341798
998984646
628290938
5325954874
588269355
1289776221
501217011
3448257798
174016341
2925723116
230165960
0
4858300982
1513770347
203115727
567460881
3282626295
1579778332
118704315...

result:

ok 39 numbers

Test #6:

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

input:

100 100
625523923 397126368 622482337 50044663 282326106 584537470 11161042 767469663 775231505 38108273 281498454 907083294 678794591 635907141 372966119 766007648 9798000 654037225 570808130 159734009 310145458 732994610 796789159 289454559 17763418 912226905 846876252 976391084 2547421 841971321 ...

output:

1028815386
2565357728
2132581373
51188744
1923143741
2329445415
1276899616
2972962796
10980640
0
0
506020970
3538157020
2859563832
0
1506404015
2045539833
506020970
506020970
306106766
4207973602
4210162878
1364863017
2908367181
6643863687
2998080361
1765379989
932864490
0
1765379989

result:

ok 30 numbers

Test #7:

score: 0
Accepted
time: 200ms
memory: 44236kb

input:

200000 200000
348718853 532670248 155714850 719869881 465340657 826516219 596376465 977645668 744500604 64554178 162908685 260541790 736900929 29895006 317242305 5753195 226813215 86108563 763068512 977866607 170952378 777213064 177115806 248463094 754555127 87601738 564615860 329855149 211410564 86...

output:

15385424753089
929749503739
794314099796
3221164446998
7818508339015
2534795288333
5161248007594
11703609944829
2385055669041
841653638357
6076087552675
13455121410535
10734842389258
3457951155585
13035297035702
4200826989098
4384546516441
12931492000743
2215417237917
3663928960
1341622290771
818089...

result:

ok 66956 numbers

Test #8:

score: 0
Accepted
time: 199ms
memory: 44292kb

input:

200000 200000
526802277 106219092 894719596 40466655 444689911 665962292 31181153 615796952 670467464 51891065 837169124 317068830 674701020 54721440 684436820 83201112 360317834 240356121 341531938 122163552 318016126 397360842 692223315 470337477 776868984 662944650 572677377 910280010 940157580 9...

output:

5935162143780
1500569663804
2749813513966
11540000438863
13475593817783
348721698632
3078203632684
3655622254263
1473155148727
517151739465
3278669291883
1139228966532
2115838400736
1868488084611
1644475442295
3125781900634
591088253182
9310791302434
223547818583
11349370523626
3837052818676
6155070...

result:

ok 66429 numbers

Test #9:

score: 0
Accepted
time: 187ms
memory: 44320kb

input:

200000 200000
409918405 534543745 488500149 771128837 424039164 210441069 760953136 664013644 891401619 334195247 511429564 78628574 612501110 229290977 906407143 160649029 643565556 99636383 509929956 561427793 465079875 872284427 502298120 987179156 799182841 388030666 285771598 635929063 11361499...

output:

487857198207
8409936480482
206026742106
890557244749
6960890502670
47238349234
11499043369592
323099700696
4047253383804
233085611819
3798158638906
6742843514934
3445406848333
101924843410
964952509144
3755707849206
1077888786260
3555220443484
1047094546322
406321261777
1457651238414
2109707346273
3...

result:

ok 66472 numbers

Test #10:

score: 0
Accepted
time: 193ms
memory: 44372kb

input:

200000 200000
882969125 403059885 787313407 941982506 258164226 900144037 635949311 302164928 112335775 911466725 890722707 840188317 550301200 254117410 273601658 238096946 72037471 399108133 678327974 560500546 757367815 787399501 577214142 209053540 231562106 963373578 998865819 216353924 1373293...

output:

614366943050
1883472339200
3753704947427
1502660414756
7190956481909
2986279422339
910540302497
1096838468800
5991775734666
1663071701509
1521070535782
597889750611
7676704079142
6427405211886
3021586691839
6138951037084
1300811544024
6719388926977
8772657055062
7316153317324
7862020872101
289452728...

result:

ok 66425 numbers

Test #11:

score: 0
Accepted
time: 193ms
memory: 44364kb

input:

200000 200000
766085253 976608729 526318153 672644688 237513480 739590110 365721295 350381620 38302634 898803612 564983147 456523869 193133994 133719651 495571981 315544863 60317897 553355692 551758696 999764786 609464268 112579983 92321651 871119411 253875963 538716491 6927337 796778785 15819429 88...

output:

1092068653898
4060818988119
7427822983951
106510123208
5842752770120
3529975597368
2253017476418
2834956421301
5970279962727
4068612851108
5581725128746
2932499171655
5619993709062
1105771139588
5884518208879
2718326461304
3049902329661
423328165355
9208691874183
1446970339131
298595495368
171400044...

result:

ok 66840 numbers

Test #12:

score: 0
Accepted
time: 184ms
memory: 44356kb

input:

200000 200000
223715029 875854236 376649005 2174064 139601097 737819067 93985068 152215205 111695119 142002096 296413303 560013541 610331651 174191951 314562950 480676781 741920725 602950242 195447777 553209520 179013895 357637925 200830118 140762964 522074354 116920520 408925447 991798581 327245377...

output:

957618551829

result:

ok 1 number(s): "957618551829"

Test #13:

score: 0
Accepted
time: 177ms
memory: 44300kb

input:

200000 200000
401798453 449403080 970429559 27803541 118950350 427522035 968981243 495399193 332629275 129338982 265641039 321573284 548131742 348761488 831500569 558124698 25168447 462230504 363845795 992473760 31110347 977785702 570713435 362637347 544388211 987230728 122019668 572223442 645926985...

output:

4515613120991

result:

ok 1 number(s): "4515613120991"

Test #14:

score: 0
Accepted
time: 184ms
memory: 44360kb

input:

200000 200000
579881877 172695029 709434305 758465723 98299604 972000812 403785930 838583181 553563430 411643164 644934182 937908836 485931832 373587922 198695084 780796807 158673066 761702254 532243813 991546513 323398288 597933480 85820945 879479027 271734772 857540937 130081185 297872495 22944980...

output:

1410665959662

result:

ok 1 number(s): "1410665959662"

Test #15:

score: 0
Accepted
time: 186ms
memory: 44356kb

input:

200000 200000
462998005 746243873 713280266 929319393 932424666 516479589 573749402 181767169 39338802 988914642 173970430 994435876 423731922 253190163 420665407 563277428 146953492 620982517 405674535 430810754 470462036 218081258 600928454 101353410 439272821 727851145 843175407 583330060 5481314...

output:

742408246260

result:

ok 1 number(s): "742408246260"

Test #16:

score: 0
Accepted
time: 184ms
memory: 44284kb

input:

200000 200000
641081429 24825421 452285012 249916166 206741215 206182558 8554089 229983861 260272957 976251529 848230869 755995619 361532012 278016596 642635730 640725345 575425406 920454267 574072553 870074995 617525785 693004844 411003259 763419281 461586678 157969865 556269628 163754921 571845730...

output:

1585975933319

result:

ok 1 number(s): "1585975933319"

Test #17:

score: 0
Accepted
time: 188ms
memory: 44220kb

input:

200000 200000
953487012 219038224 302615865 579445542 813861536 499378810 31785158 177041639 333665442 924482717 579661026 714261099 778729669 468232000 461626698 100824558 257028234 824824625 217761634 423519728 892108116 83286978 374287534 33062835 434817772 881398086 253235034 653742014 588304381...

output:

4205294638367

result:

ok 1 number(s): "4205294638367"

Test #18:

score: 0
Accepted
time: 185ms
memory: 44360kb

input:

200000 200000
131570436 87554364 896396419 310107724 498243494 189081779 906781333 520225627 259632302 206786899 253921465 475820843 716529760 493058433 978564317 178272475 540275956 979072183 386159652 717559777 39171865 998402051 889395044 549904514 457131629 456740999 966329255 939199579 76176179...

output:

466274210280

result:

ok 1 number(s): "466274210280"

Test #19:

score: 0
Accepted
time: 186ms
memory: 44368kb

input:

200000 200000
14686564 220911721 340433868 335737201 332368556 733560556 636553316 863409615 480566457 489091081 928181905 532347882 359362554 667627970 50791536 255720392 968747871 983576638 259590374 861856721 331459805 178358341 109535257 771778897 184478190 181827015 679423476 664848632 78547611...

output:

3154927887986

result:

ok 1 number(s): "3154927887986"

Test #20:

score: 0
Accepted
time: 177ms
memory: 44236kb

input:

200000 200000
192769988 794460565 934214422 211623575 311717809 278039333 511549492 501560899 701500613 771395263 602442344 998940330 297162644 397487108 567729155 333168310 662061001 137824196 427988392 301120962 183556258 798506119 624642766 993653280 206792047 757169927 687484994 540240789 663966...

output:

3159472909097

result:

ok 1 number(s): "3159472909097"

Test #21:

score: 0
Accepted
time: 189ms
memory: 44304kb

input:

200000 200000
370853412 662976705 673219167 237253052 586034359 262709598 946354179 549777591 627467472 53699446 981735488 910243178 529930030 572056645 639956374 555840419 90532916 142328650 741610602 300193715 330620006 418653897 994526084 510494959 229105904 627480136 400579215 825698353 68768054...

output:

4110209559975

result:

ok 1 number(s): "4110209559975"

Test #22:

score: 0
Accepted
time: 200ms
memory: 44248kb

input:

200000 200000
533515891 267254916 523550020 566782428 193154680 260938554 969585248 351611176 700859957 1930634 8132940 13732849 947127688 612528945 608690447 15939632 772135743 341666304 240075491 148605744 605202337 663711839 103034551 780138513 497304294 350908357 657353133 20718150 294073786 150...

output:

5303591318652
228154114416
4426221253750
21987144820
191808489260
185106934825
1366755157809
2807555378273
12248732882783
358063777960
11254866481583
9826791641446
17246611521958
421693778624
1669260695782
4092955938193
6492492955974
1087231489345
8730039151325
493877644292
4391877211782
32003319150...

result:

ok 200000 numbers

Test #23:

score: 0
Accepted
time: 212ms
memory: 44240kb

input:

200000 200000
6566611 135771056 117330574 887379202 172503934 805417331 549614127 399827868 776569921 284234816 387426084 480325297 589960482 787098482 975884962 798420253 55383466 346170759 113506213 292902689 752266086 283859616 618142060 442204384 224650855 75994373 665414650 601143011 877596610 ...

output:

10000238909824
8260425431445
44418578938
10683218158772
232285776460
2041108856097
7411141184340
1997250463071
13666576150823
4601964113095
2138268491559
4298881025268
1288646606212
3235173308864
2238256011069
343819383782
441817193757
416216263419
1037318102649
2209333925550
175491075559
2759925492...

result:

ok 200000 numbers

Test #24:

score: 0
Accepted
time: 205ms
memory: 44300kb

input:

200000 200000
889682739 709319901 561368024 618041384 6628995 495120300 574353407 37979152 997504076 566538998 916462331 391628144 527760572 516957619 197855285 875868170 43663892 500418317 427128423 732166930 44554026 904007394 282992673 664078767 951997416 651337285 378508872 326792064 196278219 2...

output:

301334430671
4673269924264
1742342499726
6491285979010
1890142889607
2504309728771
11383720054997
5738717474018
5405087330559
14794427290448
46701911609
426806801320
2410925884746
1219759511498
1332280728760
1900175327363
4095660653092
6649341311790
4833199093553
1241273803854
11189603303535
5876315...

result:

ok 200000 numbers

Test #25:

score: 0
Accepted
time: 211ms
memory: 44236kb

input:

200000 200000
67766163 432611849 155148577 788895053 280945545 334566372 9158094 86195844 628503640 848843181 885690067 153187888 465560662 836751348 860017096 953316087 472135807 504922771 595526441 731239682 191617775 83963684 798100183 180920447 974311273 226680198 91603093 907216925 219992531 12...

output:

1055234452353
277141028080
6484660132621
515345632464
82829433986
3406275821633
7000373007
8035548783313
3443577031580
2794615114562
390088675530
1059722682847
4215636292749
966244833427
14933577083958
7024204399224
3557892694620
11908479365114
433056154735
656637107865
176682534867
3206387937967
30...

result:

ok 200000 numbers

Test #26:

score: 0
Accepted
time: 205ms
memory: 44320kb

input:

200000 200000
245849587 711193397 894153323 519557235 260294798 879045149 884154269 429379832 849437795 131147363 264983210 209714928 108393457 716353590 787020123 30764004 460416233 659170329 173989867 170503923 43714227 999078758 313207692 402794830 996625130 951766214 804697314 192674490 98482652...

output:

11147329860190
3401650886027
318427628804
9592352038904
174056068526
7688702528327
3539311134622
2786719822381
7153953544734
3769033334493
2319908132614
415589903282
830325312727
1357447227506
7717596829639
9473375211137
3301627055636
1528012778175
2120020597538
9266715588241
8154604713904
167770608...

result:

ok 200000 numbers

Test #27:

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

input:

2 200000
259744081 485547098
217549144
1 1 222545135
3 1 2 552921888
3 1 2 927342369
3 1 2 761783511
1 1 623092027
2 1 532410123
1 2 796033536
1 1 676146507
2 1 545669096
2 1 909158261
3 1 2 618576992
1 1 896705335
2 1 515890953
1 2 972249583
1 2 385152946
1 2 456501879
2 1 868977392
2 1 955795997
2...

output:

62378799
436799280
271240422
55555210
813044384
868692182
0
601113406
0
0
0
0
639894457
471527436
771137339
463650612
0
136822783
111118915
370413730
293595196
426648849
0
124616525
0
0
0
0
0
105333932
0
0
0
562800137
735671260
202974014
274039145
163667911
423179332
745073145
899993820
330202613
0
...

result:

ok 66561 numbers

Test #28:

score: 0
Accepted
time: 29ms
memory: 43156kb

input:

2 200000
989516064 123698382
438483300
1 2 81459496
1 2 871011141
1 1 38086299
1 1 829078137
1 2 361413954
1 2 959936844
1 2 965629963
1 2 990966638
1 1 336186248
1 1 640553075
1 2 506336881
1 2 495118931
1 2 94325789
1 1 695135210
1 1 271256333
1 1 906581369
1 2 886244706
1 1 73571107
1 2 346816354...

output:

5484172

result:

ok 1 number(s): "5484172"

Test #29:

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

input:

2 200000
864512239 171915074
659417455
2 1 755719936
2 1 368619743
2 1 700248110
2 1 112325860
2 1 234844676
2 1 107000593
2 1 480737472
2 1 13280495
2 1 754313174
2 1 664267387
2 1 273856107
2 1 339428518
2 1 505127898
2 1 966002644
2 1 996843571
2 1 517797470
2 1 693410487
2 1 666762000
2 1 522938...

output:

50776424

result:

ok 1 number(s): "50776424"

Test #30:

score: 0
Accepted
time: 37ms
memory: 41124kb

input:

2 200000
594284223 660323254
585384315
3 1 2 507224366
3 1 2 627251137
3 1 2 923674605
3 1 2 399288533
3 1 2 867598149
3 1 2 762374691
3 1 2 504277030
3 1 2 888770809
3 1 2 808706115
3 1 2 427463512
3 1 2 154755709
3 1 2 259952893
3 1 2 740409229
3 1 2 370042026
3 1 2 881243381
3 1 2 47127994
3 1 2 ...

output:

0
0
254451443
0
198374987
93151529
0
219547647
139482953
0
0
0
71186067
0
212020219
0
0
0
0
0
314975048
156503518
0
0
0
0
35764546
0
0
0
100771528
0
207444690
0
58127463
0
115254755
0
0
0
9620199
0
0
27119029
0
0
0
0
282795639
40548204
0
0
51114614
317174358
0
0
0
0
0
0
0
0
322484052
0
0
0
279281835...

result:

ok 200000 numbers

Test #31:

score: 0
Accepted
time: 206ms
memory: 44372kb

input:

200000 200000
519572523 661762605 995160923 744609161 808524645 47450374 583713352 946873404 506060348 707386973 187735118 922703601 814348846 163399625 321746759 174151213 371110160 233172311 88248993 492974117 687794057 799526921 47426014 961557315 334979988 671124562 751883026 97374375 385953538 ...

output:

17188319484032
17188498899492
17236439812031
17202042412398
17101464492936
17219829074490
17213029246561
17105102572720
17110987573490
17172648484940
17091657426006
17200841866943
17205170719911
17254313810517
17172643242312
17181494527670
17199869152937
17156737303270
17183868025666
17216698304793
...

result:

ok 66872 numbers

Test #32:

score: 0
Accepted
time: 202ms
memory: 44364kb

input:

200000 200000
854112665 396347273 362996093 591521708 536338668 186905413 251889430 730904319 612162805 644763428 182702477 940735876 24575605 600809371 613194901 594403058 66175792 488730053 860223268 663713253 122044016 686025696 973344759 933424222 782761859 229398477 549653004 83204672 323392568...

output:

16973038365647
16984334741873
17033638309670
17007784113629
16950662199055
16990184715096
16919490979982
17041213772817
16959491628117
17013919050586
17017706468335
17051284310251
17042655522049
16951226053710
17039917804649
17013510464507
17037289600729
17086366279114
17057902687742
17073671219253
...

result:

ok 200000 numbers

Test #33:

score: 0
Accepted
time: 192ms
memory: 44304kb

input:

200000 200000
9497262 9025225 6078002 9235084 5937399 5048398 6064912 9624930 9759245 4213848 4524359 2241133 1972092 1559360 5811869 7077067 3300966 3245840 2114479 6346770 4605826 4289030 4914284 7898058 2014744 2155926 6867993 4339313 2342534 521189 2544587 9584629 2472126 6674511 9830384 4874941...

output:

26864957512
78111489685
2404312171
37746233889
4712605134
138810837612
54115923633
41833829015
57565434016
196016437
86161412975
35183165263
35042033712
32411380268
10898958896
11616654811
62121270643
91773882228
11574842711
149497815
4373827765
31775504879
50937180551
59801768859
5746466561
7982166...

result:

ok 66541 numbers

Test #34:

score: 0
Accepted
time: 195ms
memory: 44236kb

input:

200000 200000
1418399 1848794 9705821 8807929 5489363 2883568 2977459 7247465 9214284 2646823 8555274 3376294 9348547 6592128 3844144 2336529 5934904 9661278 2557812 6445106 5387759 1296009 5653421 7372210 3546222 8074671 8543411 7153887 616449 8291166 8374884 2247852 9807542 4178700 7487905 1636654...

output:

25914687164
59244083367
24180791997
32135249245
147157137901
16790749136
36075202997
25913596434
11055729984
139270611948
10313993974
39286118386
60191296644
30649310026
8292563198
6842296389
29359503562
62973255633
14173774297
123605161747
14590975677
18094599908
94881656527
64875117590
4983722550
...

result:

ok 200000 numbers

Test #35:

score: 0
Accepted
time: 187ms
memory: 44324kb

input:

200000 200000
5008420 4647333 943170 8349798 6426974 9872998 8136463 879566 3153329 6183055 9747764 4333262 4469808 7734428 7830331 3473642 3742462 7851963 9378694 3506331 287831 1440975 4910663 6994509 6461448 9214446 1398277 1198689 4647410 9767011 4439966 9248940 8664971 5505452 8052671 5518839 2...

output:

46940889448
10660365039
81080594371
16543119615
102125100927
9106868060
61497258199
26725189460
9028547595
32224614756
50849244357
13908036433
4717335214
166615024325
167130681963
3379492058
77920022417
3522855198
21419341792
40941918662
1968640374
58279116539
4227196105
74141031841
135368284252
444...

result:

ok 66874 numbers

Test #36:

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

input:

200000 200000
7186452 2438197 9538285 7922644 5978938 2740872 5049010 8502101 2542960 9391838 3778680 5659911 2037751 2767196 5862606 8733105 1343697 4267401 9565131 8637371 5845573 3672146 617095 6468661 2960223 5133191 8040992 8980560 7954029 7536988 5302967 1912163 967683 3009641 5901680 7313255 ...

output:

134599733450
9924729928
4287901863
9668105619
79592389424
2945040072
32809568984
88396246637
23607325588
6729405174
104747759748
3705909641
39448238634
85830780971
3550406936
81061597498
9405728984
2897148703
2052027032
93508992345
2030652787
166027178390
34529774829
111054392992
29890748810
3769398...

result:

ok 200000 numbers

Test #37:

score: 0
Accepted
time: 197ms
memory: 44244kb

input:

200000 200000
1718564 1911509 1445568 5025408 8270883 6932501 9398291 2301394 339202 6725215 9973087 4432965 4557736 9034529 8884163 3813780 2857230 7889917 2465716 4778858 5584450 9591115 632185 5378536 584933 4822548 4097198 2709794 6561837 9214744 5170626 9760546 8107108 6486089 5271800 8253412 5...

output:

15832996406203
5291483594519
2094485779253
129328844718981
15219493932621
1546373704468
4776913867045
124330629599900
165324870986621
51391330564332
15050603838042
182110456677
40238377086677
8539866943438
57431200080616
61999522167938
26517006708100
287072129829
88729090521116
48144977494669
143552...

result:

ok 66789 numbers

Test #38:

score: 0
Accepted
time: 210ms
memory: 44304kb

input:

200000 200000
8606997 4735078 5073387 4598254 7822847 4767672 6310838 9923929 9985729 9933998 9228194 535423 6901487 9226080 1883734 4040538 5491168 9338059 7684857 4877194 1399087 1565390 1371322 9628495 2116412 741293 5964105 748561 9611560 6984721 1000923 2423769 5442524 4247174 2929321 47829 903...

output:

78267362719913
4471101960400
8887904519626
20351048995353
172744211510813
29427516038890
94977490278
34863581400602
23053262021980
116382646197007
10018999295070
3279303083690
105240138850455
12377484774282
2766718208828
39000283412910
10357456883334
576282400485
125801442033807
3941196627355
150248...

result:

ok 200000 numbers

Test #39:

score: 0
Accepted
time: 188ms
memory: 44244kb

input:

200000 200000
1925227 2691111 3619634 9121244 8746853 354429 5295592 8497915 5595794 9255349 1517181 8856822 9370781 2861473 1229715 9484971 9044547 3761352 1826467 2076520 7921750 8861668 8505336 5989620 5155003 1840484 6350002 1866375 9748588 5208427 2851141 6368590 5607800 4430799 4204791 705512 ...

output:

114524677431794
86243201532979
163659042243719
140247154357514
23182804935707
69838909661084
81715276401591
43690848656508
55168096255651
49840062052623
1058474338523
37160481533117
5732577554639
88042488203208
10407499265988
127337628898829
23882342164868
3314886663800
32902889139463
72851831795409...

result:

ok 66745 numbers

Test #40:

score: 0
Accepted
time: 215ms
memory: 44288kb

input:

200000 200000
4037852 547384 2214748 8694090 8298817 8189600 2208139 6311938 209617 7431428 706880 9991983 1714532 7894241 9261990 9711729 6645781 9985302 7045608 2174856 8512195 5868647 9244473 5463772 6686482 7759230 3249613 4615542 7831016 2978404 3714142 4064516 2943216 2191884 2119208 7467225 9...

output:

17460089440030
31677828614789
7448752063663
46284686162672
86714122486264
70254408217946
13812434941230
121817162555276
137462146060025
1657376800604
130912862261273
86569862283407
80710211654822
80116780493315
68456651485419
64552705132216
10308260213741
69922607642081
11596440441690
54596514652884...

result:

ok 200000 numbers

Test #41:

score: 0
Accepted
time: 188ms
memory: 44316kb

input:

200000 200000
998167090 994772447 999158966 997764644 994214018 993382135 993485046 991478564 996286629 994423463 990610596 997757351 998424996 997317283 991439299 996144874 998108958 997330256 991382954 994015646 996495812 999929546 999707398 994069991 994750171 999636318 991842389 994650974 995610...

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 67106 numbers

Test #42:

score: 0
Accepted
time: 206ms
memory: 44320kb

input:

200000 200000
990279715 992563312 992786784 997528978 993765982 991217305 995364889 994068395 995741668 997632246 999608808 994116704 991025644 997574242 994438870 996371633 995710192 998778398 996602095 994113982 997086257 991903821 990446534 998319951 991248946 990330871 993709296 997465549 998917...

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 200000 numbers

Test #43:

score: 0
Accepted
time: 185ms
memory: 44368kb

input:

200000 200000
993342157 991810571 997764100 994877183 996636589 995959235 998685386 992365175 998911252 991810485 993848275 999075846 998554224 991778711 995499208 995172140 999382978 997612373 990517923 991017566 992735520 991639563 995222324 995295492 990217267 991970574 992188959 994636156 999017...

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 66695 numbers

Test #44:

score: 0
Accepted
time: 203ms
memory: 44296kb

input:

200000 200000
990487486 999601435 996424622 999417324 996188553 993794405 995597933 995146494 998557779 995019268 997813783 995243711 991154871 996811479 998498778 995398899 996984212 999060514 995737064 996340094 993325965 993613838 990928757 999545452 991748746 992665127 999023162 997385322 992323...

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 200000 numbers

Test #45:

score: 0
Accepted
time: 191ms
memory: 44240kb

input:

200000 200000
995019597 999331643 998266498 996520089 993256306 997986035 994914509 998754299 991321317 992352645 994073598 998984062 993674856 993078812 996553039 990479574 998240849 992683030 998637649 997257389 993064842 994756999 990943847 993679519 999373456 997387188 995079368 991371452 990866...

output:

1185181765
0
525971326
512866295
1181001693
1181001693
0
714524669
0
0
0
1182905756
985446945
86796144
27013398
69869326
0
1189520701
240315877
0
0
92228147
1196153377
0
933464705
566939367
1196763154
0
0
1196763154
0
0
0
1041065499
93890730
0
0
0
1179325745
0
1265940791
1885216592
0
0
703548051
0
0...

result:

ok 66835 numbers

Test #46:

score: 0
Accepted
time: 197ms
memory: 44320kb

input:

200000 200000
996940734 991898315 996927020 991060231 992808270 995821205 991827056 996568321 990776356 995561428 998039106 995343415 996018607 998303067 994776802 990963228 995907492 999098468 993856790 997612621 993655288 991763978 991682983 992962183 995872231 993240525 991978979 994120619 998948...

output:

0
0
312742576
0
321002521
0
0
0
0
117549362
321002521
321002521
0
321002521
0
0
0
316870115
0
115401953
0
0
0
0
0
0
67285457
0
0
567772187
0
316870115
0
0
140384345
0
887777677
0
316870115
0
0
0
0
637872636
0
0
312742576
0
0
0
0
316870115
0
140384345
312742576
0
0
321002521
0
0
0
26918872
0
0
260742...

result:

ok 200000 numbers

Test #47:

score: 0
Accepted
time: 193ms
memory: 44304kb

input:

200000 200000
992978761 993240033 995296731 999911870 999341578 994389533 994879392 992582331 994864269 996924226 998182975 994497338 999131190 999033406 998740951 996965363 994210431 998848822 995160154 990865044 990486390 994876542 996910098 990293949 996388028 991656227 994415898 999763970 993046...

output:

0
360210655
47428536
0
0
0
91653582
0
0
127448513
0
0
480148545
0
0
0
0
243680652
0
0
160434857
0
0
0
89758894
0
0
0
0
0
194748758
0
373699227
221621518
0
0
0
0
0
0
0
466871984
333293930
429202104
0
0
0
4866602
0
0
0
0
0
400734688
0
0
282857748
0
284651486
0
0
0
0
0
0
76347937
0
0
364396776
0
0
0
0
...

result:

ok 66757 numbers

Test #48:

score: 0
Accepted
time: 202ms
memory: 44248kb

input:

200000 200000
990124090 996063602 998924549 994452012 999150438 992224703 991791939 990396354 999286604 995357200 992405379 990599795 991474941 994066174 991997417 997192121 991811665 990296963 990379296 995930676 996301027 996850817 997649235 994800804 992886803 997574972 996091317 997545841 991320...

output:

0
0
23576927
441847210
801339756
1143360365
839665183
88146223
0
1342713281
238421104
0
0
198603132
0
0
0
336245937
0
0
351246815
247599806
0
73845838
882249903
0
0
0
215544245
0
245128041
369411737
0
0
0
0
0
1126406258
0
0
0
0
515310364
0
414714483
1109582238
1420848575
729883283
0
258168654
0
0
0
...

result:

ok 200000 numbers

Extra Test:

score: 0
Extra Test Passed