QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#246562 | #7768. Grievous Lady | zhouhuanyi | 4 | 1157ms | 4564kb | C++23 | 1.2kb | 2023-11-10 22:09:45 | 2023-11-10 22:09:46 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define N 3000
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int T,n;
long long A,B,a[N+1],b[N+1];
__int128 ans;
struct points
{
long long x,y;
bool operator < (const points &t)const
{
return x!=t.x?x>t.x:y>t.y;
}
};
vector<points>solve(vector<points>p)
{
long long sr=-1;
vector<points>st;
sort(p.begin(),p.end());
for (int i=0;i<p.size();++i)
if (p[i].y>sr)
sr=p[i].y,st.push_back(p[i]);
return st;
}
void write(__int128 x)
{
if (!x) return;
write(x/10),printf("%d",(int)(x%10));
return;
}
int main()
{
vector<points>p;
vector<points>st;
T=read(),n=read(),A=read(),B=read();
while (T--)
{
p.clear(),p.push_back((points){0,0}),ans=0;
for (int i=1;i<=n;++i)
{
st.clear(),a[i]=read(),b[i]=read();
for (int j=0;j<p.size();++j) st.push_back((points){p[j].x+a[i],p[j].y}),st.push_back((points){p[j].x,p[j].y+b[i]});
p=solve(st);
}
for (int i=0;i<p.size();++i) ans=max(ans,(__int128)(p[i].x)*p[i].y);
write(ans),puts("");
}
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: 1ms
memory: 3644kb
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: 0ms
memory: 3632kb
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: 3592kb
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: 3672kb
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
Wrong Answer
time: 1ms
memory: 3628kb
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:
11415172451248804590 16858984330656709191 11743387769407765647 11833244321238846486 23622547363248043460 8400947277205991742 21610220771803991688 27399234263603080565 6737674561137964490 6570641889973355600 46605192449900471450 34607744927873315704 37047054920666309568 3590621548385041184 187375448...
result:
wrong answer 1st lines differ - expected: '10744024240226983435172424', found: '11415172451248804590'
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 20
Accepted
time: 3ms
memory: 3764kb
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: 3680kb
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: 6ms
memory: 3776kb
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: 3664kb
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: -20
Wrong Answer
time: 2ms
memory: 3732kb
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:
74962506956684552295 40766881286821799592 113430680594584332792 39475085564127447210 75034239734597102784 114642990233311185360 62880884828759171680 88391987352935401590 135878431948804230358 77419935392421332304 92981468117497409870 60102570653337090792 63323055428081668470 93215676055866870400 729...
result:
wrong answer 1st lines differ - expected: '89043847270164187579791579', found: '74962506956684552295'
Subtask #3:
score: 4
Accepted
Test #33:
score: 4
Accepted
time: 178ms
memory: 3904kb
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: 177ms
memory: 3840kb
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: 183ms
memory: 3844kb
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: 180ms
memory: 3948kb
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: 171ms
memory: 3844kb
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: 180ms
memory: 3804kb
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: 0
Accepted
time: 175ms
memory: 3832kb
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:
1206314604834600491034 1119441296104963138384 1123876884566594672337 1096537212504409630032 1064807427535883667207 1137079534043177812430 1114299100608605298840 1149370513762212354837 1159295486322931238232 1100057109579102316785 1081177664398208627275 925851735020075974656 1165911221996672803442 10...
result:
ok 50 lines
Test #40:
score: 0
Accepted
time: 185ms
memory: 3888kb
input:
50 100 1000000000 1000000000 484255912 581700376 164068276 726162507 561102689 710215271 281917758 678218496 657146727 426929479 143309815 504477341 482866106 103593065 944744487 203878698 281294988 845280975 289804938 652525126 418521540 541250642 502773971 238583201 592290172 792629277 494300197 2...
output:
1108343874687154591200 1111939665109089926354 1102651058051675198862 1242832024965741889624 1023005312263687445262 1013851239412637217152 1189410395299064827157 1114655557499286702072 1053775885728461646813 1259807732952058454855 1154665991321686630260 1198945873543960531125 1191443635016156961225 1...
result:
ok 50 lines
Test #41:
score: -12
Wrong Answer
time: 43ms
memory: 3756kb
input:
50 100 1000000000000 1000000000000 894260718566 197346467809 236032642435 419179620749 974324513083 335358411797 457556094354 596292226422 251612556304 684864004030 628573346664 608790342094 32321877980 49088467041 889350432223 602057751372 35004414715 759571800839 754186821876 652543943275 41727331...
output:
1440810188326986311345 1070647660718650338454 1205047584219110340600 658612037220078780786 1485912397305913974162 1079398365625142120712 1519898382040794469886 1170566769784270427842 1578974560333517065254 1799179283820128815086 1813233420531055406725 2080204659731428029324 1690600376319913847418 18...
result:
wrong answer 1st lines differ - expected: '1078584444354939263007994896', found: '1440810188326986311345'
Subtask #5:
score: 0
Wrong Answer
Test #49:
score: 0
Wrong Answer
time: 1157ms
memory: 4564kb
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:
1558826632335943308 1720604298895332012 1566995547547191344 1477769754719427048 1501631994867540052 1502515837643796855 1575766800234382382 1445179996556288902 1566313284676257040 1461319660781627500 1304726787706177862 1480854579984463684 1529575136811401976 1373133914732889660 1498619392916980570 ...
result:
wrong answer 1st lines differ - expected: '1024354444153173318804', found: '1558826632335943308'
Subtask #6:
score: 0
Time Limit Exceeded
Test #51:
score: 0
Time Limit Exceeded
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:
result:
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...