QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519198#7768. Grievous Ladyzyxawa0 1176ms4084kbC++14757b2024-08-14 17:17:372024-08-14 17:17:37

Judging History

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

  • [2024-08-14 17:17:37]
  • 评测
  • 测评结果:0
  • 用时:1176ms
  • 内存:4084kb
  • [2024-08-14 17:17:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef __int128 ll;
void print(ll x){
    if(x>9) print(x/10);
    putchar(x%10^48);
}
int n,t;
long long u,v;
ll ans;
struct node{
	ll a,b;
	node(ll a=0,ll b=0):a(a),b(b){}
	bool operator<(node k){return a*k.b>k.a*b;}
}x[3001];
int main(){
	scanf("%d%d%lld%lld",&t,&n,&u,&v);
	while(t--){
		for(int i=1;i<=n;i++) scanf("%lld%lld",&u,&v),x[i]=node(u,v);
		sort(x+1,x+1+n);
		for(int i=1;i<=n-9;i++){
			ll a=0,b=0,c=0,d=0;
			for(int j=1;j<i;j++) a+=x[i].a;
			for(int j=n;j>i+9;j--) b+=x[i].b;
			for(int j=0;j<1024;j++){
				c=a,d=b;
				for(int k=0;k<10;k++) j>>k&1?c+=x[i+k].a:d+=x[i+k].b;
				ans=max(ans,c*d);
			}
		}
		print(ans),putchar('\n'),ans=0;
	}
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 12
Accepted
time: 2ms
memory: 4080kb

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: 12
Accepted
time: 2ms
memory: 3736kb

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
Accepted
time: 2ms
memory: 3856kb

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: 12
Accepted
time: 0ms
memory: 3848kb

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: 12
Accepted
time: 2ms
memory: 4044kb

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: 12
Accepted
time: 2ms
memory: 4080kb

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
Wrong Answer
time: 14ms
memory: 3780kb

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:

5465146464
5552197448
5955611500
6076687500
6834032920
5481389376
7451771470
5450289714
6977976200
5101000710
6275269800
5071629150
5327852058
3085534920
4329671280
6872691996
6035107125
6369419260
5433194610
4660865748
6130110294
6347061370
6285193443
6104364500
5293328589
7219749540
5922801090
432...

result:

wrong answer 1st lines differ - expected: '4341634878', found: '5465146464'

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 33ms
memory: 3856kb

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:

14371142760
13849087512
13936823880
16302342546
16908782856
17183813724
15151438603
13527359475
17148806532
16049673528
16919097294
11566707150
13547477865
14659709400
13831663488
16318636754
17101823013
15526032704
11275157656
16851945240
16086733760
17963116500
16784221872
16188048968
14116253010
...

result:

wrong answer 1st lines differ - expected: '9075997372', found: '14371142760'

Subtask #3:

score: 0
Wrong Answer

Test #33:

score: 0
Wrong Answer
time: 138ms
memory: 3800kb

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:

218042829056
209699323695
194877010350
180893216480
183785992478
227648516500
187479109602
196613326121
213786265200
203011134375
198478691194
208905959988
214443176064
222083043000
217671608173
225143783956
200413075500
221493367519
217427912130
192590393532
215987607950
197374675680
188258542092
2...

result:

wrong answer 1st lines differ - expected: '99383125432', found: '218042829056'

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 138ms
memory: 3820kb

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:

212148814897513340
209438431011346770
227874348130381128
207471413344553631
228776980057610184
212694882324600020
206462790640531152
206555960119198144
223609258551113350
180328055746273470
189817831303635184
204440347043933100
195839020258455784
213784851516479566
193112556359277464
229799217652582...

result:

wrong answer 1st lines differ - expected: '122583343290315160', found: '212148814897513340'

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 430ms
memory: 3804kb

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:

2009919239853898409020
2165328526587972223800
2097477217781603161504
2080553972814321935400
2136452931638361161607
2120919508372871363400
1842217158625904586708
1992094067834361297280
1937596034599347264276
2093617684392308998182
2170105101788330082075
2075705694685884984840
2145311065032444966429
2...

result:

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

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 435ms
memory: 3820kb

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:

20729407345832018491591
19252688868111221160768
18652550549073305224026
21003086450448287803719
21061363503323918924883
20372186619503238596500
18663323517333689228881
19234828594690828354560
19016134036992302500728
19795721967455790064524
20830610560541409466602
20621424891244383354490
207347717718...

result:

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

Subtask #7:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 1176ms
memory: 4084kb

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:

14472371088851660786208
14910226259736710266704
14946377208371887116888
15624909098992446781608
14412283285807873486164
15184208595245929215858
15157075997408894121168
15639803688497834372982
15110271338606515830033
15329993932082347603129
15011862465156878829798
14765395515698739234528
154993508963...

result:

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

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: