QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#454657#7768. Grievous Ladykkkgjyismine432 1769ms4136kbC++232.1kb2024-06-25 08:57:182024-06-25 08:57:20

Judging History

你现在查看的是最新测评结果

  • [2024-06-25 08:57:20]
  • 评测
  • 测评结果:32
  • 用时:1769ms
  • 内存:4136kb
  • [2024-06-25 08:57:18]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define i28 __int128
#define pii pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
int n;ll a[3030],b[3030];
vector<pii>vec,v1,v2;
int ps[6030],tt,Vis[6040];
mt19937 rnd(time(0));
void solve(){
	vec.clear(),vec.pb(mp(0,0));
	ll s=0;
	for(int i=1;i<=n;++i){
		scanf("%lld%lld",&a[i],&b[i]),s+=a[i],v1=vec,v2.clear();
		for(auto v:vec)v2.pb(mp(v.fi+a[i],v.se+b[i]));vec.clear();
		int p=0,q=0;
		while(p<v1.size()&&q<v2.size()){
			if(v1[p]<v2[q])vec.pb(v1[p++]);
			else vec.pb(v2[q++]);
		}
		while(p<v1.size())vec.pb(v1[p++]);
		while(q<v2.size())vec.pb(v2[q++]);
		ll mx=-1e18;
		v1.clear();
		for(auto v:vec){
			if(v.se<=mx)continue;
			mx=v.se,v1.pb(v);
		}
		vec=v1;tt=vec.size();
		for(int j=1;j<=tt;++j)ps[j]=j,Vis[j]=0;
		shuffle(ps+1,ps+tt+1,rnd);
		if(tt>3000){
			v1.clear();
			for(int j=1;j<=3000;++j)Vis[ps[j]]=1;
			for(int j=1;j<=tt;++j)if(Vis[j])v1.pb(vec[j-1]);
			vec=v1;
		}
	}
	i28 ans=0;
	for(auto v:vec)ans=max(ans,(i28)(s-v.fi)*(i28)v.se);
	vec.clear(),vec.pb(mp(0,0)),s=0;
	for(int i=1;i<=n;++i){
		s+=a[i],v1=vec,v2.clear();
		for(auto v:vec)v2.pb(mp(v.fi+b[i],v.se+a[i]));vec.clear();
		int p=0,q=0;
		while(p<v1.size()&&q<v2.size()){
			if(v1[p]<v2[q])vec.pb(v1[p++]);
			else vec.pb(v2[q++]);
		}
		while(p<v1.size())vec.pb(v1[p++]);
		while(q<v2.size())vec.pb(v2[q++]);
		ll mx=-1e18;
		v1.clear();
		for(auto v:vec){
			if(v.se<=mx)continue;
			mx=v.se,v1.pb(v);
		}
		vec=v1;tt=vec.size();
		for(int j=1;j<=tt;++j)ps[j]=j,Vis[j]=0;
		shuffle(ps+1,ps+tt+1,rnd);
		if(tt>3000){
			v1.clear();
			for(int j=1;j<=3000;++j)Vis[ps[j]]=1;
			for(int j=1;j<=tt;++j)if(Vis[j])v1.pb(vec[j-1]);
			vec=v1;
		}
	}
	for(auto v:vec)ans=max(ans,(i28)v.fi*(i28)(s-v.se));
    stack<char>stk;while(stk.size())stk.pop();
    while(ans)stk.push((char)(ans%(i28)(10)+'0')),ans/=(i28)(10);
    while(stk.size())putchar(stk.top()),stk.pop();
    puts("");
}
int main(){
	ll ta,tb;
	int t;cin>>t>>n>>ta>>tb;
	while(t--)solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 1ms
memory: 3804kb

input:

50 10 10000 10000
8450 6001
2804 803
8972 6155
8161 1938
4806 6582
2927 9312
9157 1289
6486 3737
8239 257
7292 9051
6079 2510
1408 5174
6821 772
8947 3187
100 5067
6986 9882
2067 1776
2734 6298
8909 4770
1083 1077
4929 4165
4788 5873
5490 6802
6829 6136
8919 4869
9488 4505
1052 8990
57 1445
7680 822...

output:

1356022774
902566854
1140061305
967802717
879903720
890841120
1080286757
1250989070
1362698900
1413511168
1137531330
775920120
934759445
981422955
1136968923
839143260
1277454816
522098415
1244442420
1173533392
899456910
665601553
1193825850
1122903576
845410521
1263368813
1302451776
811132751
10328...

result:

ok 50 lines

Test #2:

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

input:

50 10 10000 10000
9994 4842
1922 7614
1936 9958
9262 8443
8720 8834
7271 3310
3047 4277
1750 2453
6070 2889
3798 3031
2501 8157
5431 5964
6347 179
8316 176
6647 2595
3613 2724
9626 5687
4326 7389
5403 7261
2454 1235
5553 6024
8417 6403
7437 4767
3583 8990
7341 1101
5547 4696
9850 1151
9236 7642
9147...

output:

1205984720
1064613313
1181141416
745894788
954402457
1166670472
848497233
1220235285
749940533
1302492620
1201885634
1038468151
941992320
1232153580
957687204
1151181720
1415985570
843533980
1410180345
591520050
1187581494
1037049840
1125205536
1073427795
868248043
1476506400
606549255
1298210470
12...

result:

ok 50 lines

Test #3:

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

input:

50 10 1000000000 1000000000
494574201 920783166
595927955 755325735
309577744 179185250
211824757 104989303
153612343 475522134
147518010 954162295
14870931 809174851
144588437 714960306
500467723 342648884
451897537 16352725
387829577 604905371
164562427 730017330
174013757 88116170
413352963 25848...

output:

8019248717016210432
9562527646373455452
8316256835644358400
10005244913590584859
13600042354030978692
12385669444391539400
11638163461119484906
11974077265411034380
10096692774042519989
9960378434146500426
14025594920966212062
14923543759395878404
9861052158328471348
8381947936335561125
120501034028...

result:

ok 50 lines

Test #4:

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

input:

50 10 1000000000 1000000000
991645300 361776971
455155949 20944241
72069996 680425401
298214562 101945897
530411139 39387398
220968213 1914319
884830859 749725549
36039314 152226727
484179177 386642907
569311031 307149546
240753176 2714740
148247928 995919685
158261284 93215502
388781214 531670359
3...

output:

6036438600482297296
8811413715140283238
12679622391869586104
8204811850512148473
10418687790647502102
7645971394095089244
13648690750777823794
11917282893288883065
8689467554250131528
9240668109432320172
17386650737420520731
12807064894581257184
11044508677206376716
9743458729411083144
7946263228251...

result:

ok 50 lines

Test #5:

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

input:

50 10 1000000000000 1000000000000
452242903787 598320455618
897775886187 712578201902
969042843729 167543616827
718657501516 605486301858
16135431449 377705809990
583006744137 13342406041
632418936902 66527987006
908433110167 485690193392
980955783266 145439788449
609490069042 165930765030
662730721...

output:

10744024240226983435172424
8162254398037512282360202
12259087405116054442697823
10230365858644351120311965
8778195034117404266302632
13560005520819337164008816
6847981215247928839768608
17772746912972676549660120
6719140805740539897988960
10535531800250118920309808
8484818147000083008915360
94417746...

result:

ok 50 lines

Test #6:

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

input:

50 10 1000000000000 1000000000000
252213554996 412082947870
52422350530 879664591707
31479991811 350215382918
65076142589 78414527870
6037959280 731280802622
644802070642 859528824214
637856203323 794806665757
552477104189 510102574181
497391804280 295147487856
177887878411 625764707427
61141847821 ...

output:

7190432589639509802748512
9563227305996344935123739
8479042335132791826449120
13738549302991797170740028
11164737407217768313308856
12889494226114565024564160
14253517817753145331918230
10986503247613232910773129
12906929123904168206745689
8181034212778456002511329
12495323158419802977210984
1139790...

result:

ok 50 lines

Test #7:

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

input:

50 20 10000 10000
7383 7716
3121 8895
4260 9576
2740 4647
3165 7689
1815 267
6840 7660
1962 909
1181 2330
2543 6925
8682 6577
9260 3670
9357 1796
4686 9265
6173 2759
8833 3792
4178 2003
3768 2965
7576 8104
4315 5607
337 1558
6916 9572
9184 4035
657 1754
6078 2280
4262 6492
6792 8628
9048 371
7423 83...

output:

4341634878
4396541613
4865626297
3726788100
4837717464
4087659820
6279625339
4374662918
4235554690
4764301488
4637361552
3564842115
4629610083
3533115064
4033389030
3805591622
3545855280
4920281942
3542552920
4276558040
3336422860
4679746848
4027243338
4032709343
4570332690
5805642927
4165549674
399...

result:

ok 50 lines

Test #8:

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

input:

50 20 10000 10000
3119 6557
6431 7194
7224 3379
6545 1152
7079 9941
1967 7369
8026 6455
3034 2328
5909 9553
9049 8202
9695 2224
5987 4459
8883 3907
4054 6255
2720 2990
5460 5146
4441 3210
5361 9864
4070 7891
5686 9958
3665 3417
9057 7399
5322 7808
7411 4608
4500 2704
7616 9387
8293 5381
5522 6568
61...

output:

5301580768
4743459163
3293840064
4047099926
4607193633
4437297660
4386522155
4811081889
3025332019
4246837653
3525210052
5083603161
4075000554
3387924876
4704898575
3977619120
3986138607
5064015577
3767312498
4306984030
3908760216
4324601880
4515027612
4762669500
5126350757
3656035370
4114287150
395...

result:

ok 50 lines

Test #9:

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

input:

50 20 1000000000 1000000000
247317622 740320449
42890664 315194094
858857363 592949945
78071520 502996986
496276010 300380714
59027885 924156726
158337596 69077397
137576312 899170204
614761790 43879440
170216033 501122557
892144793 987591109
205528506 158913403
477768744 124292209
729525385 6679849...

output:

42473194906470025775
63832043893233086516
45542153518026877231
31045468382461968804
33565456509318510854
59405103879975876151
38623872500842491764
37047692399605907660
54649078512354672084
47284357857763022878
47388970838021532298
45038337991662988880
54423871256124760890
37449784975847887924
328260...

result:

ok 50 lines

Test #10:

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

input:

50 20 1000000000 1000000000
555621304 66044179
906033291 755023948
992729101 85303201
778142947 537320046
553308352 682530242
770667714 140911973
252954651 138149659
374709492 916558890
620853645 719826714
304316840 374279611
775287335 377917292
68944628 685523865
114124576 796076677
695190350 68376...

output:

49246763068173858248
45887201481533521146
50815860731253918387
42689404719766397180
46111954590954168875
40944302256363408000
37866906938744088138
44435024701275126631
43579531069268985386
53753720893083063792
36078579106002481605
51002235271993262720
40349373695671481956
48146667591996050034
340954...

result:

ok 50 lines

Test #11:

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

input:

50 20 1000000000000 1000000000000
812976983494 481536082019
469180763986 267617938799
365623442070 173716257144
385450387463 458181225551
546569396398 973633742295
125540392440 670826300411
486743077577 564519437282
617766293974 206425199201
126317880627 190679355313
667160238891 343706237537
861253...

output:

39596179808114515870851094
30049515038319403285245543
43164809935988442792009628
34597062599695910248258610
45559429049498962506439325
46651383622154812412663318
51193582758376007172193061
50197200045146210562775256
54309612217905450139009835
49484066305347537371504722
46003566531555993247132700
521...

result:

ok 50 lines

Test #12:

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

input:

50 20 1000000000000 1000000000000
617242601999 291003606975
660682004138 397849552796
464915365960 347798088643
695014252728 931109451562
532176956934 290353959118
187335718945 517012718584
459620535486 251648372929
257515320701 189687836887
679608677449 303532278912
231263080963 803540179934
525686...

output:

35564346247438625102275686
33970805767545073750872759
40996602453639579580618728
41374629873496631861833236
43981034239780037908737489
43545369450750301167937908
41668480117037455343460546
51352899072452641302556659
36205001665761465753448155
32737477297045990658153488
32226078981765898178383552
418...

result:

ok 50 lines

Subtask #2:

score: 20
Accepted

Test #13:

score: 20
Accepted
time: 6ms
memory: 3812kb

input:

50 30 10000 10000
4853 6897
1727 7443
2329 2876
5355 3477
2872 4090
2719 1756
989 681
7909 4601
8835 4634
9358 3999
8141 3749
8476 9479
2527 8659
7238 5965
3058 2946
8 2928
8116 7269
3840 2790
422 930
2018 8310
1708 7842
3701 3484
2944 9028
4308 9528
4704 6890
7982 8335
1596 9290
7031 745
6121 7262
...

output:

9075997372
9741088812
10477290528
10327786031
9141835285
11432058683
10870358352
7778666504
9641567016
11776211156
10497065841
9179627443
9286255875
9491961765
10977950304
9468844866
10773619480
9039361190
10296624454
11768814156
9105586680
11348624584
12677685920
10307061072
9933184000
9600793237
9...

result:

ok 50 lines

Test #14:

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

input:

50 30 10000 10000
589 5738
8142 5742
6781 3575
6456 7279
1378 9046
7062 5754
2174 6372
3173 3317
6667 6050
3159 5276
4562 5204
2498 7165
6244 4962
6607 8762
5413 474
9339 4283
8379 6988
8137 1177
6915 3421
3389 8468
9229 9701
34 5502
9083 6993
1062 8190
3126 417
4041 1231
3097 1451
2018 4238
1780 16...

output:

9525996254
10892213498
10404171996
9081771489
11496784068
11078110925
8614479825
8945324070
10270120308
12448176883
9274530918
8957530754
10860447360
9184738320
8296323966
8312249517
9710416600
7810910448
10149108215
9764597076
11977831971
9486264928
9319753240
10409846790
8899503690
8889334266
9011...

result:

ok 50 lines

Test #15:

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

input:

50 30 1000000000 1000000000
251485114 444587657
228926791 639208393
74483764 587762337
852967201 938371135
78981735 943523557
753951577 63154380
86269901 162534212
326503386 663502367
311244770 82095951
610254546 717995726
131711656 362793661
981001013 408326096
578856228 386961896
35934522 82007884...

output:

95513417737596173816
98057339222793552912
91933458100788624543
100742437545774921139
85432511714412896685
106631816958254679182
87881703799163785436
85351048378348363110
101403813022428872736
73061441966819669328
87066955086118798944
89912900703705809648
104090886410630590168
97496700770277297775
77...

result:

ok 50 lines

Test #16:

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

input:

50 30 1000000000 1000000000
453588917 590614166
647963296 314892307
836976016 89002488
939357006 230295025
160813235 802356118
682177589 965682211
806486724 957860718
367697366 395736085
735147712 126089974
22635336 859049443
544443767 760603030
109910706 819452642
268136459 687028523
306330068 5334...

output:

136473479895443810784
78109198125677225429
97343284068509144049
91460240363500302457
100900158636994005206
109299481714621929546
80934943955868845986
122740123816087526142
83313106371847146229
107816724205614554015
107310087009518194516
101488941871890279680
118279872595601324400
1072690170699369279...

result:

ok 50 lines

Test #17:

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

input:

50 30 1000000000000 1000000000000
712536851853 147085361638
316184463274 986219344346
116021449753 324468986218
342125502940 424387702722
672099199341 511482241663
449360103498 183819288286
492072511667 648338764053
483172557234 994583709184
929802650459 994183670528
622247957333 310747203616
155554...

output:

89043847270164187579791579
95721270558202900501004686
89904393761878771844984240
118534916262937987558281680
82960718143402203298567065
115142569016854056953424360
84824979978256108144566561
111110803223094126678486128
100810088290128771448351835
87626230363062514524648528
99174061386240458921756554...

result:

ok 50 lines

Test #18:

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

input:

50 30 1000000000000 1000000000000
516802470358 923993078083
470830927617 153305734151
215313373643 502845785014
688544144012 893020961438
662001727173 869352201591
511155430004 30005706458
506099712681 335467699700
127216551257 14701122678
483093447281 139596402639
190645766702 774876113309
59082015...

output:

98994919884320745404022127
100585709924815256957895604
94587526380275226229643832
66700900749598517096560376
105852989407695513547342740
102652662382873735497063615
130191476559239032414687727
101680658727639627217575198
111300760707299329261170150
84182619364533658846955389
867240237339761460021914...

result:

ok 50 lines

Test #19:

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

input:

50 40 10000 10000
7978 8612
9340 7023
7617 489
9934 6186
1231 1005
8902 2712
5968 9755
681 4476
9074 1299
1904 1874
8039 5112
9032 9463
5063 6579
2976 9340
9131 7934
1854 5350
2931 601
9067 2161
577 4264
5250 5544
7116 3746
4341 1775
8126 6260
840 7850
374 4301
52 323
8551 415
8725 9671
7351 4308
12...

output:

16943814384
19984972085
18241530650
17677895175
14165586787
17191400688
18189577752
17993912244
19063539462
19455491545
19473309475
17286439324
15397478544
17417016905
18096699600
17674711571
16511339566
15204189765
16829145638
17679707427
18061949815
18102807544
19172534288
23784170315
20491850805
...

result:

ok 50 lines

Test #20:

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

input:

50 40 10000 10000
6883 918
7971 8699
9941 7815
1419 4192
771 1397
3 2754
7411 9173
411 7040
3373 6880
1893 1166
9422 4853
8136 3428
3095 7764
4958 892
1708 8916
5398 6632
6550 6494
5507 7481
8017 5631
2699 4969
5327 490
4936 7122
5042 164
4699 3061
886 7798
8276 981
2261 1327
6827 8489
9953 4399
523...

output:

16656008802
18866695783
18564333065
19654818534
18139157650
18590858286
16596591556
15913292797
17310815778
17948793498
20924473304
17481120354
16898921232
18197062575
17616266080
14644706076
14197667400
19482900437
19079586472
18002205977
16529890275
16364402607
16909309756
16219176865
17322812353
...

result:

ok 50 lines

Test #21:

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

input:

50 40 1000000000 1000000000
606989354 340998427
97173704 331101978
892766115 841467982
828781498 124012179
723034536 640318091
524622596 898516894
964774923 596850242
731729276 263159932
164668611 846064293
298855001 302406769
524981354 618379309
410880439 312879687
185454269 58567955
176614167 1682...

output:

182411506063391670000
177070255296642379880
186805282217562964656
163692812008942636224
160756570683473271312
158911212976866152429
178556643660848358238
169667942069649787598
171111903440590260495
168375123625049064048
191196584040803324760
192033443051877582832
169352414193521664990
16665326176147...

result:

ok 50 lines

Test #22:

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

input:

50 40 1000000000 1000000000
514125861 781992232
516210210 6785892
655258367 637675430
915171303 856127557
950090227 58959163
157881312 946268918
129702146 392176748
213114745 995393649
148380065 890058316
416268494 738427783
232680761 16188678
394565940 724006234
24477605 358634582
301785521 1766445...

output:

175253606023544437376
192759660804285809027
135206128148864767956
165671679476110679662
184152556658611077642
178793952768091093133
165084930540085358680
168176997382484599914
206915301752728488724
189808407150615258915
200787397629220293105
134401979308127308008
186643373457723269657
18299481263928...

result:

ok 50 lines

Test #23:

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

input:

50 40 1000000000000 1000000000000
155378488542 416048868181
525438168919 961900191346
924502058094 236113039019
161972040577 737718182253
532934561856 84655713982
544794419528 817224514176
192967136528 181046963702
677936525576 756832118151
233241837311 956136748738
52503542980 688177083042
24016384...

output:

160142380805772304669561302
146929674399724272599366099
198635954889344354758956776
178302782692310468122264464
181889504254805692835842512
197997836932637599573232919
160696687834899408133994549
175104672674940138003931305
164084605103760012705973422
184970061770821822596348896
17943754466664983880...

result:

ok 50 lines

Test #24:

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

input:

50 40 1000000000000 1000000000000
955349139751 225516393137
721234376366 92131805343
23793981984 410194870519
467240938546 173791632457
485982313879 442525673909
602294778738 667705899645
202699370245 872470866645
326275486894 744389723133
749677858324 105844448145
620901352349 152305992735
67542974...

output:

145486026460981849150035318
168594486154278396138248785
192984433106627904601897388
142545891804039885735519340
165289049036136269840422088
171302772702618617643491790
180136165526196246824147361
169609123379854984953280296
176528030420125091555292650
156339656982446324808547984
18245644781220603984...

result:

ok 50 lines

Test #25:

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

input:

50 50 10000 10000
4273 1087
1874 9980
2264 7434
705 8908
624 6060
355 7008
1204 2556
3727 8199
5780 6321
638 2356
2899 7465
7373 1134
6106 4788
1327 4574
1235 3271
7913 803
3806 5914
6437 3057
191 6474
4559 9341
5918 4536
3435 291
4085 2135
285 17
2326 8978
4287 8585
7715 1508
831 3923
8228 4366
222...

output:

24778857672
24982423344
25958619154
26833235079
29183591269
27967245934
31732880400
30408926900
25381843083
27020146166
25835981652
21819803491
22944098928
28214384374
26291963725
29007332031
25031347693
32292051528
29148633612
25869727940
32874521561
26728773855
28592178006
26117185402
28174630942
...

result:

ok 50 lines

Test #26:

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

input:

50 50 10000 10000
8 2633
8289 3687
5228 1237
8702 6901
9130 5208
1995 8301
2390 5543
6287 4211
3612 3545
7144 9041
3513 3112
1396 1923
223 8387
696 6971
7781 6607
7245 3645
1365 9825
733 4148
6685 1669
5930 9500
735 3691
9768 2310
3328 100
4334 8679
748 9401
346 8376
6513 8261
3114 120
6991 8742
969...

output:

28867244888
26931412942
23607142956
26716167608
26642790691
32794409394
27232189460
31731227580
28700525574
31792532843
24769935976
30059940810
26846252530
24221354126
30432938886
30444328436
27629915957
28359842544
22878644068
27306578754
26609708532
28942258572
29128014468
25193585072
24022393296
...

result:

ok 50 lines

Test #27:

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

input:

50 50 10000 1000000000
7479 200369058
3931 548151733
1396 237067643
3083 103630323
7016 67901850
6108 259109869
9984 805833005
574 518386786
4751 320795041
277 533552272
8810 309441834
2585 247732415
1468 292938558
7206 812329142
115 528593690
6285 706409540
1713 236847164
7441 571766713
8748 585338...

output:

2736742404205702
3150479058499800
2586746216291344
3039883076912995
2675680654220981
2714335982217450
2951950574538504
2533165287698357
2999861207950684
2052158999615040
2577736081298963
2825808111825384
3064983622196130
3189667129466664
2800291451085006
2837456915405476
2295264242172072
30665562021...

result:

ok 50 lines

Test #28:

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

input:

50 50 10000 1000000000
7918 521737314
6725 722721270
5911 314515560
3509 962910585
7738 66974603
9856 584290351
7494 27707388
4431 798762402
8972 46444094
397 15786735
740 338760616
4876 909675847
473 680500454
1936 936559217
7352 621383801
6578 405027654
6006 546381618
5630 808551988
5559 677630139...

output:

2833350831277822
2343528380092176
2597470945503660
2887967930191337
2751406458749010
3160023467227809
2715394230968269
2489994097975911
3006734767004469
2393485078766616
3090227910660940
2792961611928944
2806244872544568
2629965229075439
2658760707223125
2760399461934162
2642866615425114
26242885543...

result:

ok 50 lines

Test #29:

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

input:

50 50 1000000000 1000000000
614197277 187747513
822400912 832272756
112254430 697904469
307999359 546059131
374585393 887874496
142841391 523823884
848161443 152438504
247296600 352028753
391609779 635282894
841935075 219027140
854760791 501716489
564441712 123837366
312480120 549653056
888353489 45...

output:

236110311103337465396
234534336052980933564
230367876768344038834
272127502583129984088
249258465060551137430
288380908014981059680
307511097608914850135
296833239160084346775
224350295700638744049
248576797960421392440
228550737046043860224
315788786942755476831
249881603711775781194
33829568077251...

result:

ok 50 lines

Test #30:

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

input:

50 50 1000000000 1000000000
564286091 705614806
662721622 84692296
143749414 334052866
354213594 625616382
347740619 883484226
340293955 877135480
748127024 267402685
435887380 204742840
969226815 742014703
634663232 754689365
451414680 772425766
787297457 570429943
749313806 190182408
838032066 511...

output:

300306860049260397372
303195553579730104292
267600899132432347024
240181532375421288784
252007692939408432312
312317054740779105584
242940402151793023165
345295880582534882380
298965812362073544354
244291153118317670750
278086925467157075088
277448092602768334962
285815174604889025970
25793428328701...

result:

ok 50 lines

Test #31:

score: 0
Accepted
time: 26ms
memory: 3872kb

input:

50 50 1000000000000 1000000000000
161306651842 345097167740
89429513651 239194009445
890416771110 504510689411
592356374152 918900594896
299865428418 369274138859
759524421273 151592511003
872176485719 88013034644
160788481963 526755545593
528403323085 180650449954
578405004261 30719557662
195305231...

output:

256333357107163917224500262
291901592681441361041905504
280816581963376319222044098
276924564863732705932150656
305654488382363527861711110
292709741588069983248564230
284706059290144333778626560
286648755097746367453810060
267824261062257768025752370
275819550430749332138295836
28667176949040665951...

result:

ok 50 lines

Test #32:

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

input:

50 50 1000000000000 1000000000000
956982335756 158859659993
280930753803 373720590738
989708695000 641737745102
901920239416 391828820908
248618213145 727144098786
821319747779 34633704984
881908719437 811996746099
804832475985 546872959087
81694119906 293503373553
146802813630 490553500060
59371635...

output:

259171165652928584002491393
299332376078974929528987600
235474316865113459579956758
268563297758683432948798400
255549606146540060956071900
258046891281917206470738030
237219207451415019871941296
271942998997563061183648584
255298142369137541258498496
261503480731621014471126360
28990020812447650399...

result:

ok 50 lines

Subtask #3:

score: 0
Wrong Answer

Test #33:

score: 4
Accepted
time: 169ms
memory: 3924kb

input:

50 100 10000 10000
3817 9367
533 166
3422 6775
1637 2003
4512 2346
7101 356
2772 4037
6684 180
8703 7518
4497 9606
9197 9761
7217 8544
332 7886
9189 4475
2622 7432
729 8677
3451 5287
8879 6942
4972 487
1370 3918
1009 5847
6307 2158
2380 9771
6296 9946
6644 2651
5624 5590
3171 1058
1608 8006
6185 687...

output:

99383125432
104811638659
112729256865
95121987940
118672536221
111893576256
104841972644
111108172500
123989724360
120695447525
104473835537
109353741512
112579826958
105383244393
110610633843
111211215702
111030606150
102942142176
103918702650
105812839958
121157116262
105484644782
125888304869
117...

result:

ok 50 lines

Test #34:

score: 0
Accepted
time: 166ms
memory: 3916kb

input:

50 100 10000 10000
3781 3549
3677 7205
3512 9016
1960 9921
4939 9905
2015 404
3416 4518
4193 1859
2560 7726
8718 4467
6613 6927
3339 7327
2623 1318
4002 9075
7352 211
5263 6083
9552 3402
7764 1397
8969 4275
5477 5458
8923 4314
2525 1209
2770 4400
9192 7181
5531 9272
4183 9202
2683 8571
3647 7987
240...

output:

112327572336
114293976410
117951056828
106767105004
112417001838
113939762280
107105545112
110511882647
115251735585
120655016004
112252156510
106001179508
123865980147
96991585712
105777760912
100592904627
108347998320
110198694780
99793026081
125554404780
109890923504
106931475391
113618517866
108...

result:

ok 50 lines

Test #35:

score: -4
Wrong Answer
time: 168ms
memory: 3892kb

input:

50 100 100000 100000
24779 53022
10197 19663
8227 15511
13415 80908
44481 75266
68336 52768
28869 63344
62938 97846
97921 5700
68736 22955
25404 60053
32084 8593
74064 31247
6842 60910
40493 57042
43083 50778
66484 93970
44724 27813
45628 82517
91668 97870
86032 67448
35457 54253
65070 15339
84196 3...

output:

10467865569734
12760769817475
9553438423648
11505145748928
10952900162985
10352968744082
11009244465624
11117821946590
11628400689499
10818533551904
11194891139715
10833335223252
10565839978825
10551952240830
11304930499296
10050201697006
10840333479510
9762490127596
11242330198124
10947286769328
97...

result:

wrong answer 26th lines differ - expected: '11169507942425', found: '11167881565204'

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 12
Accepted
time: 163ms
memory: 3900kb

input:

50 100 100000 1000000000
64674 582989836
17174 628184989
7993 598433899
93758 468751386
36632 620786833
54253 85788398
24335 220088249
41708 370324059
57541 192813008
20125 886362267
3571 180283386
31249 729879131
48870 314235662
40658 954471739
36545 20574741
87835 599485007
44057 459200718
16186 4...

output:

122583343290315160
123180788743136835
106848070437186806
121399598099481552
114671328948865344
109261786979152885
110804547540967368
113454653581765212
115223347014415782
110426946040785506
99271607302919308
106746424290880101
116326704862592262
117403415008037235
111777281124226281
1120538340236074...

result:

ok 50 lines

Test #38:

score: -12
Wrong Answer
time: 167ms
memory: 3884kb

input:

50 100 100000 1000000000
67522 520789926
43607 555188016
12806 26905813
74021 342182108
872 913074774
77839 600895907
98718 947434810
27725 83418280
15106 511494616
87291 653881493
13841 729625677
74682 845713944
43470 585103095
70733 680058976
93952 631790842
81757 406650788
78511 347358907
1462 79...

output:

111520718305066983
111150031374464374
105780424303141838
114502300985346801
115023403779126336
120051990993902080
108860924694174885
124780394360220333
105947234484838092
101750061643019517
103438889113853510
124268485639108728
110280919053980670
109164067626109363
117339974852626500
120296159408922...

result:

wrong answer 46th lines differ - expected: '112019267409200838', found: '111994655611671040'

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 1769ms
memory: 3968kb

input:

50 300 100000 1000000000000
21621 667704611522
95538 504360767965
20121 374291791983
58259 527043478787
9507 542834074255
46613 834605157827
59064 675317470117
92489 500884084061
92529 451667545421
21745 407068201316
3514 222491362996
44418 198133054017
8437 358148875035
28745 928794182062
90101 554...

output:

1023858342975639274030
1089713334401763808029
941374506128169678047
989674704339379680930
1050789110988127244577
964271547272914832392
1037642972407112197664
980002153754201476175
1006594341982615449675
903402152273489594720
989708282491655104584
957913045507418234076
957247318763418900063
997305337...

result:

wrong answer 1st lines differ - expected: '1024354444153173318804', found: '1023858342975639274030'

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 1763ms
memory: 3928kb

input:

50 300 1000000000 1000000000
622938742 803340090
411563373 506291511
661934617 381755435
876890605 94166677
279496763 869423201
508007585 131998848
592251587 47733172
703056185 932460203
228695499 72609615
129679067 589829468
272070690 179647026
185157790 460526572
351519179 920281520
843895312 1023...

output:

10141075225599120560016
9890880967279671266448
9353355920150588778128
9944250931178766232125
9324833686985487320792
9972932258299609438840
9645517006058917163008
9151241169360893936151
9374374056352325700064
10576935764378668047120
10057580413621650602334
10161670768775400726042
98846765808733835586...

result:

wrong answer 1st lines differ - expected: '10145178504143463639155', found: '10141075225599120560016'

Subtask #7:

score: 0
Time Limit Exceeded

Test #61:

score: 0
Time Limit Exceeded

input:

50 800 100000 1000000000000
98918 860842806148
33478 598362503847
18531 201301091495
53208 640503897011
43307 430663243504
74638 460997604730
14440 749299232168
15540 46909570195
54856 833537407449
70810 868074038174
17982 623720662739
34195 105105463226
76704 538435018409
23449 43950632205
21959 38...

output:


result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #73:

score: 0
Time Limit Exceeded

input:

50 1500 100000 1000000000000
18757 387292221744
29053 379348011407
47483 314966420174
80638 546097965718
84807 917566638908
59364 705165061774
25136 779704406223
23865 837453418495
38499 811293770591
84972 313037387571
23632 69910257865
36366 901965627066
33323 800225614191
75382 895280109542
95500 ...

output:


result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #85:

score: 0
Time Limit Exceeded

input:

50 2500 10000 1000000000
1989 715660116
726 205696491
906 80983641
1280 135698142
9814 930386766
3162 86759005
1412 262080798
8338 590216389
8436 932386996
9530 971462836
3099 385836418
6344 24362894
4400 361413630
9974 582107128
1025 746910753
2258 921930336
3036 21556198
5903 237088626
9254 502009...

output:


result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #93:

score: 0
Time Limit Exceeded

input:

50 3000 10000 1000000000
2737 308421419
1673 866261939
7204 148757554
1832 755475073
6111 239582749
5110 227503898
7381 928418391
4831 719415538
4618 750355710
1602 775678323
490 537881445
163 880774777
8544 75938451
2585 496945876
3375 309585347
1089 926499529
7965 908906210
1001 39148177
9619 6401...

output:


result: