QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340054 | #7768. Grievous Lady | cinccout | 0 | 414ms | 3652kb | C++14 | 1.7kb | 2024-02-28 13:49:39 | 2024-02-28 13:49:39 |
Judging History
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;}
const double del=0.988,eps=1e-8;
__int128 suma,sumb,ans;
int c[3005],n;double C;
void mnth(int T)
{
random_device rd;
mt19937 rnd(rd());
uniform_int_distribution<int>s(1,n);
while(T--)
{
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;
//cout<<tmp<<endl;
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'+x%10);}
int main()
{
//freopen("1.in","r",stdin);
//freopen("1.out","w",stdout);
int tim,A,B;cin>>tim;srand(193548);
cin>>n>>A>>B;int T=2e7/tim;
while(tim--)
{
for(int i=1;i<=n;i++)
a[i].a=read(),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;
}
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: 381ms
memory: 3576kb
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:
1346536700 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:
wrong answer 1st lines differ - expected: '1356022774', found: '1346536700'
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 392ms
memory: 3576kb
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:
9023206140 9741088812 10477290528 10327786031 9141835285 11432058683 10870358352 7751876552 9641567016 11761180260 10497065841 9179627443 9286255875 9491961765 10977950304 9443923152 10773619480 9039361190 10296624454 11768814156 9105586680 11330538870 12677685920 10307061072 9933184000 9600793237 9...
result:
wrong answer 1st lines differ - expected: '9075997372', found: '9023206140'
Subtask #3:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 397ms
memory: 3652kb
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 118657496972 111836990600 104841972644 111108172500 123989724360 120695447525 104473835537 109353741512 112548762846 105383244393 110610633843 111160561526 111006419664 102942142176 103918702650 105812839958 121157116262 105484644782 125888304869 117...
result:
wrong answer 5th lines differ - expected: '118672536221', found: '118657496972'
Subtask #4:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 399ms
memory: 3580kb
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 115222199728221696 110425263758650361 99271607302919308 106221024937776487 116326704862592262 117379619512865553 111777281124226281 1120286329345436...
result:
wrong answer 9th lines differ - expected: '115223347014415782', found: '115222199728221696'
Subtask #5:
score: 0
Wrong Answer
Test #49:
score: 0
Wrong Answer
time: 402ms
memory: 3620kb
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:
1023741725009689500640 1090081056519177596568 941669682797146533720 989699542301802680806 1051214280658160738808 964695204946332242251 1038023847913121598330 971995082787473651796 1006729446835547794866 903632831568046299468 989929037327163909480 954842322558815708019 957326934042031608618 997438027...
result:
wrong answer 1st lines differ - expected: '1024354444153173318804', found: '1023741725009689500640'
Subtask #6:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 402ms
memory: 3652kb
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:
10145178504143463639155 9894647146365241873600 9354853834412197464375 9947955606541093802427 9326536829807852502684 9970989348111038565510 9646241169745323715000 9153341254590110334400 9373703226203220582704 10579374921940145166182 10060823576937198628062 10166409844427278297956 98823811500246809399...
result:
wrong answer 3rd lines differ - expected: '9355387552828907152187', found: '9354853834412197464375'
Subtask #7:
score: 0
Wrong Answer
Test #61:
score: 0
Wrong Answer
time: 405ms
memory: 3588kb
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:
7076501875806913544866 6862628420178635280319 7339611037391512720919 7179824480553133044480 6913021316101067132782 6685515595841234022407 7118859395032918036833 6880072423047181436015 6953792452282121467606 7412740847778437854804 7179176774140878992460 7375418353457563059288 6988599639059799130300 7...
result:
wrong answer 1st lines differ - expected: '7370339999554792336414', found: '7076501875806913544866'
Subtask #8:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 407ms
memory: 3620kb
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:
24182401066435592197800 25220198706152809561332 24506068343693806155936 25104958675943414360375 26101936598323443500352 24056772417679847826578 25123075443473208282184 24605978616734562949410 24168236327923703936180 24127475763604681872010 25393523591722772758280 23636095377511393397866 242796987308...
result:
wrong answer 1st lines differ - expected: '25099931872189852821766', found: '24182401066435592197800'
Subtask #9:
score: 0
Wrong Answer
Test #85:
score: 0
Wrong Answer
time: 411ms
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:
6992498235311574930 6756055564060992708 6948133091018969805 6973766341235638815 7066865159467813842 6742145722119402621 7052326516798641000 6916719672439651352 7057282968014966895 6336615935636978935 6911943996883398550 7008989300488996460 6698667662925231060 6982111363255555590 6687187896256945000 ...
result:
wrong answer 1st lines differ - expected: '7005218822778586245', found: '6992498235311574930'
Subtask #10:
score: 0
Wrong Answer
Test #93:
score: 0
Wrong Answer
time: 414ms
memory: 3636kb
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:
9979779358565105194 9702808974516358764 9801808094821706400 10123997833337479572 7872822209935305780 9882671138216548860 10036928470232202330 10128795232908344278 10014076161214492800 9456705788912180904 10064872056255089760 9942301342267402640 8991722893612803814 9538481184728391324 983883059733748...
result:
wrong answer 1st lines differ - expected: '10107755825402443110', found: '9979779358565105194'