QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340043 | #7768. Grievous Lady | cinccout | 0 | 425ms | 3908kb | C++14 | 1.5kb | 2024-02-28 13:26:43 | 2024-02-28 13:26:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
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;}
__int128 ans,suma,sumb;
int c[3005],n;
void mnth(int T)
{
random_device rd;
mt19937 rnd(rd());
uniform_int_distribution<int>s(1,n);
for(int i=1;i<=T;i++)
{
int x=s(rnd);
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.001;
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;
cin>>n>>A>>B;int T=2e7/tim;
while(tim--)
{
long long sb=0;int id=0;
for(int i=1;i<=n;i++) scanf("%lld",&a[i].a);
for(int i=1;i<=n;i++) scanf("%lld",&a[i].b);
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;
}
ans=(__int128)suma*sumb;
mnth(T);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: 384ms
memory: 3728kb
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 808515774 1204539639 915407126 1018940208 1001435085 1467707192 1534009760 1249427340 1214100075 1053096990 731398624 1139666172 976036179 1269999522 845097900 1275686923 393050160 1223103924 1163861096 758928632 805877583 1333654956 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: 393ms
memory: 3724kb
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:
9594191682 9954803148 10095394148 10108306953 9217122526 10291953150 10416662288 732436476. 1117290940( 10364285167 1209644238( 696115735. 9137060123 9282372349 9893136390 12898762651 1243436830* 10348671758 9081764690 11892271240 8615541790 1093623417. 1237113750( 10045809449 10144232604 9922015624...
result:
wrong answer 1st lines differ - expected: '9075997372', found: '9594191682'
Subtask #3:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 400ms
memory: 3888kb
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:
102727328120 99347866714 1152574701)0 9354094255* 1140088775'' 1148498860., 1098569991// 1121508957*0 1131244017(4 1256659331*6 104579337588 1097767344// 11510584780) 10103450901- 1124841006'6 1101138484.( 1094455916'6 103552239586 94812014268 1084924865+6 1138165218*8 10271865917) 1275038902-, 1234...
result:
wrong answer 1st lines differ - expected: '99383125432', found: '102727328120'
Subtask #4:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 399ms
memory: 3908kb
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:
281916053'./2+0/*4700 279109145+0*.,7.4.7+3 294598223--/,62(70*3. 291921357).,)*54-*('9 312815157-3/74)-62234 275029599/494061*,*-3 301314438(77**217,09) 314113484+368*525,0)0 27664302706673((13.64 265148820'6069))2-'9, 2068879006)3.',947((4 1951304112*72521*79/4 297381504-(46('7/2-,2 310618814(4098...
result:
wrong answer 1st lines differ - expected: '122583343290315160', found: '281916053'./2+0/*4700'
Subtask #5:
score: 0
Wrong Answer
Test #49:
score: 0
Wrong Answer
time: 405ms
memory: 3592kb
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:
2621922300557/2*+*574.-'..** 271082313-119+0)/+1-04)+61/5 242274869,'57/057,/7(.9740-0 228690879)533/973/(*,'--546) 257200654(*'(65(061'+05,(252 231317855/5**,,0-5.'6)6.9030 24840802300-1)45832+/3/40*8' 236318788++2411,.060/33856), 230160856'1*+-.09144+891715* 231298617'4,)082.141(9*0,074 240924193....
result:
wrong answer 1st lines differ - expected: '1024354444153173318804', found: '2621922300557/2*+*574.-'..**'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 404ms
memory: 3612kb
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:
10167776702*(8((-'9,1'0 946544947569*6--/27699 9744022665),+9'1./7'(. 95205831742-0,0)6/.554 9845432323(680)10-3-20 959372069610/8990'2400 9858821086,0000+'0((4. 9351657201*/4.92+(-*23 94709315729-3837'070.8 998474261133,(426*02'1 9877271051/,0288/*/00* 100428047043-0)7(/8'70+ 95488849982930726-5+26...
result:
wrong answer 1st lines differ - expected: '10145178504143463639155', found: '10167776702*(8((-'9,1'0'
Subtask #7:
score: 0
Wrong Answer
Test #61:
score: 0
Wrong Answer
time: 406ms
memory: 3740kb
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:
182333698128'1-,178006'0+(2(( 1598688060'6547))60400.232*70 1766346905140.-*0(,3,8721092( 18359908937*0(0*931.'0)52,402 17478798643//.(*0209,(8-)+3,( 1659688028),70)913/,**0054'*6 18178111764455095,3.57(53/06. 1651325576/520,5'0/1870,).102 180633187331*+)265-853/6,','* 1848458158452,*.20*.(24(4..'* ...
result:
wrong answer 1st lines differ - expected: '7370339999554792336414', found: '182333698128'1-,178006'0+(2(('
Subtask #8:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 413ms
memory: 3748kb
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:
6307589485*.(4898'/(06(00221+ 6417145362'690010+5*(69++/+8. 62271692464*'')0000/96,03+557 62204243802040,419/010)5,24(. 657425544,08//(46/05(()1,401, 60794782700+60*0988*2.58,(01. 62126960762008)89.97*+.)()0-0 6375534716/350((*0)1'013'0502 65636561402*1992+800.'-*60983 602892085467*5(-026+66(.86'18 ...
result:
wrong answer 1st lines differ - expected: '25099931872189852821766', found: '6307589485*.(4898'/(06(00221+'
Subtask #9:
score: 0
Wrong Answer
Test #85:
score: 0
Wrong Answer
time: 421ms
memory: 3612kb
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:
17582238146-60-8,627/6*2 1695588641)4,/3,*605.5(1 17531808270+5/99974/,195 17494368323,259037.'2,+6 18052584327462.3'9)78*.' 1727569761667521')55*,68 179822097370,(6)0.(26+03 17467691814,-276+6'197(+ 17613996206890,)4,7)*.32 178074687415+93519*-/7.0 17431435404.(*+540,'*+60 173874914787.339+16547'9 ...
result:
wrong answer 1st lines differ - expected: '7005218822778586245', found: '17582238146-60-8,627/6*2'
Subtask #10:
score: 0
Wrong Answer
Test #93:
score: 0
Wrong Answer
time: 425ms
memory: 3724kb
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:
253127424*)*0/(340/04(-2 251625138/(,-0910*0-7/+0 246672329.)025/*)83/9(22 256284418('))4*)(218.-)2 2587539890641/0-,))93-1* 247131350/'-3)**5368*176 253363103('.+2000'08*'1, 252060319'-.0'1.(5,6,.60 251628928(',0-/401,7+-(8 252229050)-/6--011,.34,0 244290809--0./4.(0*///.- 255216917(*74165.1635.0, ...
result:
wrong answer 1st lines differ - expected: '10107755825402443110', found: '253127424*)*0/(340/04(-2'