QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#339988 | #7768. Grievous Lady | cinccout | 0 | 6ms | 3808kb | C++14 | 1.6kb | 2024-02-28 11:16:22 | 2024-02-28 11:16:22 |
answer
#include<bits/stdc++.h>
using namespace std;
inline long long read()
{
long long x=0,flag=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')flag=-flag;ch=getchar();}
while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();}
return flag*x;
}
const int b=RAND_MAX;
struct jgt{long long a,b;}a[3005];
bool cmp(jgt x,jgt y){return x.a-x.b<y.a-y.b;}
int ran(int l,int r){return rand()%(r-l+1)+1;}
long long suma,sumb;__int128 ans;
int c[3005],n;double C;int num;
void mnth(int T)
{
for(int i=1;i<=T;i++)
{
int x=ran(1,n);num++;
if(c[x]) c[x]=0,suma-=a[x].a,sumb+=a[x].b;
else c[x]=1,suma+=a[x].a,sumb-=a[x].b;
__int128 now=(__int128)suma*sumb;
if(now>ans) ans=now;
else
{
double tmp=0.01;
if(rand()>1.0*tmp*b)
{
if(c[x])
c[x]=0,suma-=a[x].a,sumb+=a[x].b;
else c[x]=1,suma+=a[x].a,sumb-=a[x].b;
}
}
}
}
void print(__int128 x)
{if(!x) return;print(x/10);putchar('0'+(int)x%10);}
int main()
{
//freopen("1.in","r",stdin);
//freopen("1.out","w",stdout);
int tim,A,B;cin>>tim;srand(145537);
cin>>n>>A>>B;
while(tim--)
{
long long sb=0;int id=0;
for(int i=1;i<=n;i++) a[i].a=read();
for(int i=1;i<=n;i++) a[i].b=read();
suma=0,sumb=0;ans=0;
for(int i=1;i<=n;i++)
{
if(a[i].a>a[i].b)
suma+=a[i].a,c[i]=1;
else sumb+=a[i].b,c[i]=0;
}
mnth(1000);
print(ans);puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3808kb
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:
1215737276 773320800 1204539639 915407126 1018940208 1001435085 1467707192 1499397246 1245616050 1214100075 1039061036 731755908 1106226177 976036179 1269999522 845097900 1275686923 393050160 1223103924 1163861096 758928632 805877583 1314916451 1168875512 1022561155 1336232962 1360656850 993381732 1...
result:
wrong answer 1st lines differ - expected: '1356022774', found: '1215737276'
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 2ms
memory: 3596kb
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:
9595104894 9622451750 9799304350 10108306953 9217122526 10291953150 10391500195 744875528( 1127184640( 10364285167 1209644238( 689386237) 9100675414 9227125406 9893136390 12898762651 1243436830* 10158659663 9081764690 1189603088- 809583556. 10602935708 1237113750( 10045809449 9908746333 9920962432 8...
result:
wrong answer 1st lines differ - expected: '9075997372', found: '9595104894'
Subtask #3:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 2ms
memory: 3580kb
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:
10273795230, 9845419054, 1151905775,( 9349283954* 1120511381+1 1148498860., 1095606697)0 1121508957*0 1129307737*4 1256244236-8 103733898682 1097767344// 115025461100 9850626660, 1112372351)) 1083828381+0 1094554835.2 10299040594, 9385737168, 1079351657)8 1120358492*8 10271865917) 1275038902-, 12349...
result:
wrong answer 1st lines differ - expected: '99383125432', found: '10273795230,'
Subtask #4:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 2ms
memory: 3516kb
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:
281405036,++4'(0/001- 275341637-005/-'7/.20 295494932+/-433/*03). 291921357).,)*54-*('9 312344308.2-260805/,/ 273717104-8'5*)2,'.0- 300717757+611,81'--3+ 313573896)660+/136-/* 27664302706673((13.64 265147997*3/27*)0+7)6 2064924257+6(00.79*)4 1951303763-91987742,. 297393371*(2264,,0,+2 31061881808388...
result:
wrong answer 1st lines differ - expected: '122583343290315160', found: '281405036,++4'(0/001-'
Subtask #5:
score: 0
Wrong Answer
Test #49:
score: 0
Wrong Answer
time: 2ms
memory: 3536kb
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:
261978669/9'-+.,22.'(500/(/0 270828040)34/,9,)051)40014.* 242278041(070.(073257,4-,'8( 228493823.04531.6*.6.-7/7540 255413980-(9)-2138/6'/2)55*( 230611173+9',738+(.''.3006-. 248072012*)',)-(.89,,2+142-/ 236349401.)50*1.96/*8-5)(29- 229745453)32,40/7,5)07179.-2 230885923,9*')44*3602116*0.) 239725018*...
result:
wrong answer 1st lines differ - expected: '1024354444153173318804', found: '261978669/9'-+.,22.'(500/(/0'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 2ms
memory: 3604kb
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:
10094604592062180/*9*08 9428453764/)188-..40(6 9684448466,9)305)86,6, 94889158119075710'1*.( 9840305223,3487/'/1',- 9545520352395++(8'3.56 9804128234'1,719'(.'8* 9290467287'432-5*+'775 9427639260+,75232.-*/0 99546313253-*1076/96+0 9877271051/,0288/*/00* 100254336764898*2()9807 949470180532+**0575)0'...
result:
wrong answer 1st lines differ - expected: '10145178504143463639155', found: '10094604592062180/*9*08'
Subtask #7:
score: 0
Wrong Answer
Test #61:
score: 0
Wrong Answer
time: 3ms
memory: 3540kb
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:
18224311161056'/6(-).9()67(./ 1595958631080..8.(2/50.(09/2, 1765375278839503.567+4)007+0/ 18355852857.2+5'5922).2661//6 17398687854-0(8,/.3./2-,35(.0 1652368782'1,473'*12+01'.(5*4 180651660578)90717,5+3)2'30.4 1651627089'5/0,9()343)9((.465 17924795567'4500/**.8,6.//6)9 18414234784')5+'67'80003(+'4* ...
result:
wrong answer 1st lines differ - expected: '7370339999554792336414', found: '18224311161056'/6(-).9()67(./'
Subtask #8:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 5ms
memory: 3544kb
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:
6307047793('1-5.0+//1+302982. 6416093147)0)+15'/39,,,-4/+75 62271692454'./*+74/3433(02068 621471295530/0/+2)-'))57++.7( 657368164.09+-5,6.62986,896'* 60793671271'5*4(*29.4'861/624 62125601150+9-97(-5,*.),2**-- 6375546663.6901)68./5.4579.(3 655742990'10,/40607)2))23,00. 6008105965)/-'24)'702),*+4682 ...
result:
wrong answer 1st lines differ - expected: '25099931872189852821766', found: '6307047793('1-5.0+//1+302982.'
Subtask #9:
score: 0
Wrong Answer
Test #85:
score: 0
Wrong Answer
time: 6ms
memory: 3620kb
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:
17579127325,1*(0,27+7281 1692739365(5310(+'8.5*44 17531235736(7)30)()903*6 17442520112,51/68)*'2100 18039090515961(74)/09',, 1724181954395129*9625(40 17977076198.'032518'545* 17466942540'0+8)2*'80778 17601016202'(7+.'695.936 1778822266443(9477810)0. 17429745005++0.'+5*3,0-. 173874914422-117-67./3*4 ...
result:
wrong answer 1st lines differ - expected: '7005218822778586245', found: '17579127325,1*(0,27+7281'
Subtask #10:
score: 0
Wrong Answer
Test #93:
score: 0
Wrong Answer
time: 3ms
memory: 3792kb
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:
253074160)))3380*0+*9(7( 251553012..-.)82-'0-(526 246672329,+7170.(9(6'-,, 256284416(0.)6(+-'1(0-30 258589012/909(02+485,+'. 247115792,+/4,720(**0581 253183385/0*1(-'2(138060 252062637.()*'-3(86(089. 251525284,0'*9--8'17)/*4 251857189,0-511.08-9*4.2 2443084410,+(95'9'37300( 255209353,.4110*-/)22394 ...
result:
wrong answer 1st lines differ - expected: '10107755825402443110', found: '253074160)))3380*0+*9(7('