QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#298778 | #7768. Grievous Lady | Larunatrecy | 4 | 1483ms | 3768kb | C++14 | 1.2kb | 2024-01-06 14:41:17 | 2024-01-06 14:41:17 |
Judging History
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 = 40000;
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;
for(int i=1;i<=n;i++)swap(p[i],p[Make(1,n)]);
for(int i=1;i<=n;i++)swap(p[i],p[Make(1,n)]);
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||Make(1,100)==1)
{
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: 1320ms
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: 1339ms
memory: 3752kb
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: 1326ms
memory: 3644kb
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 10005244913590584859 11491532249306235300 11659554242932564696 11638163461119484906 11123667836099313440 9083188670108391940 9179100801695880454 12912933985470190000 14923543759395878404 9234056062585174320 8381947936335561125 1140524601341...
result:
wrong answer 2nd lines differ - expected: '9562527646373455452', found: '9220523411708714666'
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 20
Accepted
time: 1347ms
memory: 3568kb
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: 1339ms
memory: 3696kb
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: 1350ms
memory: 3752kb
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:
68753030310789918912 73550118094035149460 62172401965676078166 75913634969853385500 67586478869558634612 69127469932739744504 72119278011497267040 61173834033375155833 73626537219774376824 51565455983561510390 66761071736822941995 69027141968394048836 80788219701839656447 74949922344270423060 613392...
result:
wrong answer 1st lines differ - expected: '95513417737596173816', found: '68753030310789918912'
Subtask #3:
score: 4
Accepted
Test #33:
score: 4
Accepted
time: 1363ms
memory: 3712kb
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: 1367ms
memory: 3568kb
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: 1356ms
memory: 3700kb
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: 1355ms
memory: 3716kb
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: 1355ms
memory: 3720kb
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: 1349ms
memory: 3696kb
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: 1366ms
memory: 3704kb
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:
770694954506536888881 788715617716147674750 819814909321912539000 738504207822551988993 672006252556328315544 729268103534119976616 791474426512266215508 778947425329617873962 702154711994091132516 710353046668792081393 684662985507413882411 640942520440372117976 728386504955361035721 68154191646162...
result:
wrong answer 1st lines differ - expected: '1206314604834600491034', found: '770694954506536888881'
Subtask #5:
score: 0
Wrong Answer
Test #49:
score: 0
Wrong Answer
time: 1373ms
memory: 3636kb
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:
628520504834213281188 689488444399250844828 589149248974357007725 596927040738543772103 664250907279630775728 576137615531132281600 666181569886176740050 577842576094833409974 599170810433480295405 541353949254179594370 596711926107128195712 569884408912036552824 603747321467804904960 58373694207011...
result:
wrong answer 1st lines differ - expected: '1024354444153173318804', found: '628520504834213281188'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 1390ms
memory: 3632kb
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:
5976405415488810084840 5856358802380573326879 5858185650829837968559 5853041379168965567838 5699072790500971501440 6116432302535963209565 5943198959048677270375 5587801224924636659130 5832938009181263950354 6452976698396710268664 6248049245312680854912 6214453824963801006408 6182963749694655343243 5...
result:
wrong answer 1st lines differ - expected: '10145178504143463639155', found: '5976405415488810084840'
Subtask #7:
score: 0
Wrong Answer
Test #61:
score: 0
Wrong Answer
time: 1376ms
memory: 3708kb
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:
4348469415276656127992 3991081811508282759156 4436865372932870789312 4394374935285310838649 4201284056170461700195 4055071497663737428340 4362167434582834823668 4127906963482013746405 4241895146838704892384 4335668168492460769431 4247828048568069301456 4295400345404673103312 4254019032799960003970 4...
result:
wrong answer 1st lines differ - expected: '7370339999554792336414', found: '4348469415276656127992'
Subtask #8:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 1424ms
memory: 3668kb
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:
14688674920241410401139 14685331022276424685836 14509180713642987657816 14911813861424699436864 15353722971824988366042 14394067497072049027920 14643598113577275731570 14610730904930297258457 14547157310551904833470 14312523155966961894752 15325079255912314554857 14238801509644007611710 146599214207...
result:
wrong answer 1st lines differ - expected: '25099931872189852821766', found: '14688674920241410401139'
Subtask #9:
score: 0
Wrong Answer
Test #85:
score: 0
Wrong Answer
time: 1468ms
memory: 3688kb
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:
6990424873477001190 6953370499254471611 6931683883500264222 6990671122958772776 7086524297640449434 6758640271374274976 7117669644082977714 6917922890498474793 7048714006445357125 6924757103460226800 6923775914560445616 7014611409627612420 6904907098416183012 6975641678959767594 6782618731948533411 ...
result:
wrong answer 1st lines differ - expected: '7005218822778586245', found: '6990424873477001190'
Subtask #10:
score: 0
Wrong Answer
Test #93:
score: 0
Wrong Answer
time: 1483ms
memory: 3768kb
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:
9223371636317043792 9223371880415825121 9223372016340078453 9223371630086143240 9223371918792150000 9223371736549326290 9223371975436048425 9223371977993217194 9223371593820239062 9223372010517697550 9223371636202642884 9223371905806346806 9223371825649017525 9223371810926203936 9223371975775499008 ...
result:
wrong answer 1st lines differ - expected: '10107755825402443110', found: '9223371636317043792'