QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#298784#7768. Grievous LadyLarunatrecy4 1257ms3784kbC++141.1kb2024-01-06 14:44:522024-01-06 14:44:53

Judging History

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

  • [2024-01-06 14:44:53]
  • 评测
  • 测评结果:4
  • 用时:1257ms
  • 内存:3784kb
  • [2024-01-06 14:44:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N =3030;
typedef long long LL;
#define BIG __int128
int n;
LL Ra,Rb;
LL a[N],b[N];
mt19937 rnd(time(0));
int Make(int l,int r)
{
	return rnd()%(r-l+1)+l;
}
void print(BIG x)
{
	if(x>9)print(x/10);
	putchar('0'+x%10);
}
BIG A=0,B=0,C=0;
int state[N];
const int LIM = 50000;
const int K = 1;
int p[N];
void solve()
{
	for(int i=1;i<=n;i++)scanf("%lld %lld",&a[i],&b[i]);
	A=0;B=0;C=0;BIG D=0;
	for(int ip=1;ip<=30;ip++)
	{
		A=0;B=0;C=0;
		for(int i=1;i<=n;i++)p[i]=i;
		shuffle(p+1,p+n+1,rnd);
		int mid=(n/2);
		for(int i=1;i<=n;i++)
		{
			int x=p[i];
			if(i<=mid)state[x]=0,A+=a[x];
			else state[x]=1,B+=b[x];
		}
		C=A*B;D=max(D,C);
		for(int o=1;o<=LIM;o++)
		{
			int x=Make(1,n);
			LL nA=A,nB=B;
			if(state[x]==0)nA-=a[x],nB+=b[x];
			else nA+=a[x],nB-=b[x];
			if(nA*nB>C)
			{
				C=nA*nB;
				A=nA;B=nB;
				D=max(D,C);
				state[x]^=1;
			}
		}
	}
	print(D);
	putchar('\n');
}
int main() 
{
	int T;
	scanf("%d %d %lld %lld",&T,&n,&Ra,&Rb);
	while(T--)
	{
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 12
Accepted
time: 1146ms
memory: 3564kb

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: 1151ms
memory: 3564kb

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: -12
Wrong Answer
time: 1138ms
memory: 3712kb

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
9220523411708714666
8316256835644358400
9309760514839846668
13600042354030978692
9887108156351654998
11638163461119484906
10436057799007144434
9083188670108391940
9179100801695880454
12972193518027369174
14923543759395878404
9640228597840239784
8381947936335561125
114052460134147...

result:

wrong answer 2nd lines differ - expected: '9562527646373455452', found: '9220523411708714666'

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 20
Accepted
time: 1188ms
memory: 3712kb

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: 1169ms
memory: 3700kb

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: -20
Wrong Answer
time: 1178ms
memory: 3568kb

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:

60976096774361370402
80556460263324038700
70072307897564974372
73304454788637234568
62783226686373757054
65289008775956689520
68574102242781669285
59271421279093315640
80958558589949242928
59046260885847240850
70680600092104283463
77317562229236626190
74619073260107436190
69254764537012083693
569629...

result:

wrong answer 1st lines differ - expected: '95513417737596173816', found: '60976096774361370402'

Subtask #3:

score: 4
Accepted

Test #33:

score: 4
Accepted
time: 1177ms
memory: 3568kb

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: 1172ms
memory: 3784kb

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: 0
Accepted
time: 1170ms
memory: 3712kb

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:

ok 50 lines

Test #36:

score: 0
Accepted
time: 1178ms
memory: 3784kb

input:

50 100 100000 100000
96257 21974
69941 19754
10468 77322
61332 52822
16231 73285
8385 16517
76647 70853
37321 44407
8130 67217
93597 37268
25275 79279
42354 93989
17497 66060
9954 28344
70568 44280
76298 58367
84598 68263
11882 61809
6711 29329
83208 88488
5986 56370
54509 10050
31186 75531
11430 72...

output:

11550590159540
8860005767760
12315316362980
11320250531139
11722115226249
11568253723200
12891842128744
11691686626275
12165483779825
10731100863032
11523369454960
12511572203273
13464219757022
11046689652944
11564814342564
11158806972549
11675195081274
11462012446145
10854048341304
10987852339863
1...

result:

ok 50 lines

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 12
Accepted
time: 1179ms
memory: 3584kb

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: 0
Accepted
time: 1188ms
memory: 3752kb

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:

ok 50 lines

Test #39:

score: -12
Wrong Answer
time: 1178ms
memory: 3572kb

input:

50 100 1000000000 1000000000
425480934 596069354
885929408 208894636
849118145 369603853
32862979 470731422
89195782 993965771
857712104 655472942
199757011 70181666
872007093 442633879
7677494 366180389
233638375 633102946
93301174 365363320
934036650 47362033
585644491 757551572
95389025 322632438...

output:

774143436465530953290
700805108237668491420
755812062121217943556
717830736571269820590
612099184804106408628
792677450667370875885
751909357267256198460
778649128723466359730
715706985943166524788
733463582536527665200
686702424099109864320
661217826185641279541
725080601558343570680
73013485755768...

result:

wrong answer 1st lines differ - expected: '1206314604834600491034', found: '774143436465530953290'

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 1186ms
memory: 3740kb

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:

633790224094284317824
697308200625665332782
584852944132112686950
605139849348966189456
678176559062702487885
593029687388327701656
638629346520679652496
573990271473536044932
607805926303284960541
584567287809074281400
589876934243897338210
576388734730261782312
579696393357650371706
59202493477059...

result:

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

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 1184ms
memory: 3580kb

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:

6096761066755391004102
5871596452438804973697
6279714237424608092035
5986878925372966869150
5725512835704663530208
6154136625299756181308
6004710429517584697689
5499732507353413054964
5663712604060917066582
6387070164863631587757
6103911413166760304912
6094107688044931043799
6226185820206458449150
5...

result:

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

Subtask #7:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 1189ms
memory: 3580kb

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:

4387146931601941385538
4220954167713788577122
4331804864475400673865
4288268526253280635944
4230627345996406928181
4024738348026250755519
4273128391160875742229
4110470104798790729774
4158501518034313853480
4327964746585870303902
4327821544121132566630
4281918995349484329672
4339051507843695195657
4...

result:

wrong answer 1st lines differ - expected: '7370339999554792336414', found: '4387146931601941385538'

Subtask #8:

score: 0
Wrong Answer

Test #73:

score: 0
Wrong Answer
time: 1219ms
memory: 3600kb

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:

14569753510018426420620
14485325084679360232250
14787275352068743209933
14964329075288456846256
15238445848335327301884
14223234377443553471360
14735044919001496739290
14700516347232322551952
14645906376093595120986
14283258605044086285548
15189387319566293389440
13978442073499842577109
147426834786...

result:

wrong answer 1st lines differ - expected: '25099931872189852821766', found: '14569753510018426420620'

Subtask #9:

score: 0
Wrong Answer

Test #85:

score: 8
Accepted
time: 1246ms
memory: 3756kb

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:

7005218822778586245
6971750534725612064
6954161620845859665
7013134062885514605
7100199492400670100
6776299504139543856
7135284309783918702
6936309620545673088
7068393840281136864
6942766703807986548
6944154377884217714
7029230310347143680
6918324838079558790
6998172166422429400
6798609950334386488
...

result:

ok 50 lines

Test #86:

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

input:

50 2500 10000 1000000000
1732 653460207
5671 132699518
3015 509455555
1542 449320352
4054 77450515
6748 601866515
7283 989427359
8546 303310611
3297 956101308
6696 884206255
665 230146006
7072 435165003
6296 222215656
49 307694366
8431 208383749
373 434128821
194 909714387
6987 263468142
794 7754762...

output:

6861311554744926930
6868438721666834158
7000938328427297100
6986177933898819838
6946288297434274374
6889294912143244768
6879840522539270224
6955101059714688884
6975882328390193300
6862885747280574304
6955807429667572756
6821641794893341132
7056609081747995400
6924742141404933846
6967566622405516582
...

result:

ok 50 lines

Test #87:

score: -8
Wrong Answer
time: 1215ms
memory: 3684kb

input:

50 2500 100000 1000000000000
64247 516122355312
98364 854165978664
72281 424564939374
50265 845786707126
89743 255262167218
23994 593049450047
75370 432765515137
48323 355394824524
67264 578240134085
65850 163859718473
58217 995936750988
12170 335329048325
90658 928964193417
29667 272420479286
45869...

output:

40604162216631496420254
40028650457465035950879
41983669546621253516770
40128092070426025425348
41126150628109170884052
39992497499216726759121
40114158762755123903112
38490872858316563462246
41613301788048545521230
40435026462653068732992
40155948622938235617173
40011049066846427408916
397596000672...

result:

wrong answer 1st lines differ - expected: '69855809501000434363128', found: '40604162216631496420254'

Subtask #10:

score: 0
Wrong Answer

Test #93:

score: 0
Wrong Answer
time: 1257ms
memory: 3620kb

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:

9223371994536141288
9223372030113549322
9223372032897555192
9223371957128051376
9223372030470097000
9223371963776186330
9223371843176393552
9223371984404582648
9223372027160136173
9223372034608641007
9223371989953304199
9223371992702768120
9223371843018366996
9223371888015257811
9223371952210795104
...

result:

wrong answer 1st lines differ - expected: '10107755825402443110', found: '9223371994536141288'