QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#340049#7768. Grievous Ladycinccout0 275ms3984kbC++141.7kb2024-02-28 13:38:212024-02-28 13:38:22

Judging History

你现在查看的是最新测评结果

  • [2024-02-28 13:38:22]
  • 评测
  • 测评结果:0
  • 用时:275ms
  • 内存:3984kb
  • [2024-02-28 13:38:21]
  • 提交

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;__int128 ans;
int c[3005],n;double C;int num;
void mnth(double T)
{
    while(T>eps)
    {
        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=exp(1.0*(now-ans)/C/T);
            //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;
            }
        }
        T*=del;
    }
}
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;C=1.0*((__int128)n*A*n*B)*4;
    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=suma*sumb;
        for(int i=1;i<=100;i++) mnth(1);
        print(ans);puts("");
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 12
Accepted
time: 271ms
memory: 3740kb

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: 263ms
memory: 3792kb

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: 261ms
memory: 3856kb

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: 265ms
memory: 3708kb

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: 260ms
memory: 3680kb

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:

12798793061372342921350000
7680167768163672346863592
8498445057919926319142896
14170133824285905134146752
9056529512678493732591531
12185141676867476463283636
9286392152985778739148288
15378852328813229663969328
7841123425107518062728918
7879822002593369060611125
7444388753744629359732994
9593921024...

result:

wrong answer 1st lines differ - expected: '10744024240226983435172424', found: '12798793061372342921350000'

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 257ms
memory: 3972kb

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:

8981190000
9625398276
10477290528
10297925883
9134554854
11219840892
10691867320
7473567512
9432414468
11673902982
10466000225
9179627443
9286255875
9388811310
10977950304
9130062655
10773619480
8926285500
10296624454
11768814156
9105586680
11149884430
12289410210
10307061072
9668352066
9497137972
9...

result:

wrong answer 1st lines differ - expected: '9075997372', found: '8981190000'

Subtask #3:

score: 0
Wrong Answer

Test #33:

score: 0
Wrong Answer
time: 258ms
memory: 3852kb

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:

99271287888
104571099215
109387972530
95053554830
118132004185
111604946992
104450714028
110798837625
123863890500
120147294600
98638746855
109290673999
112548762846
105262094098
110610633843
110582511884
110978063148
102163971088
103663708288
105711637625
121157116262
105293806905
125862737328
1172...

result:

wrong answer 1st lines differ - expected: '99383125432', found: '99271287888'

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 256ms
memory: 3980kb

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:

98074928447283760
123180788743136835
106786878852439680
121399598099481552
114671328948865344
109261786979152885
110804547540967368
113454653581765212
84323118827652460
110421163633398076
99271607302919308
106746424290880101
116326704862592262
117403415008037235
111777281124226281
112029104413293800...

result:

wrong answer 1st lines differ - expected: '122583343290315160', found: '98074928447283760'

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 264ms
memory: 3780kb

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:

1020755868279002053450
1090023139210972116024
937608085253000493005
981337726574200508625
1046970465855259162208
964470530982390558912
1030402887107931860076
975069243334962455680
1003418169820804579474
897065407880597983800
984758398359098905386
953188615058381103248
954263609934515795676
994868994...

result:

wrong answer 1st lines differ - expected: '1024354444153173318804', found: '1020755868279002053450'

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 275ms
memory: 3984kb

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:

10143152798047205215812
9890907800713510907229
9352985502049125376170
9927599633390832675308
9326536829807852502684
9960868563532983717966
9628864654311015979110
9101588991141081711924
9368532616099245064111
10574372731335850720128
10059512683754435359199
10166409844427278297956
98823811500246809399...

result:

wrong answer 1st lines differ - expected: '10145178504143463639155', found: '10143152798047205215812'

Subtask #7:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 269ms
memory: 3756kb

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:

6473046750132520670805
6022123389337643607204
6623525201775642399130
6493111232125054922072
6199316441245751644275
5830743221676080329596
6396461000104023336768
6038739581195264617044
6153750287794877493951
6574932115997731401762
6241451544286945584372
6408812369003325991149
6370064413129582799850
6...

result:

wrong answer 1st lines differ - expected: '7370339999554792336414', found: '6473046750132520670805'

Subtask #8:

score: 0
Wrong Answer

Test #73:

score: 0
Wrong Answer
time: 270ms
memory: 3744kb

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:

18415597453894609418144
18892473886055271610696
18888265442859153861552
18848783523051424777856
19375375547755424134776
18400425072732436258499
18749826380225373163115
18781883599709651306508
19564731227580987328182
18422257124137266941700
19033127674235061605231
18058605034138747307768
179789023146...

result:

wrong answer 1st lines differ - expected: '25099931872189852821766', found: '18415597453894609418144'

Subtask #9:

score: 0
Wrong Answer

Test #85:

score: 0
Wrong Answer
time: 258ms
memory: 3636kb

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:

4722147791256619620
4223128040785485432
4156424150849356320
4162099149507725262
4245035517331725638
4013000654977049599
4300027066037095082
4201448351493339704
4180254473427502712
4690733612045126778
4673298094831991856
4260625952735831250
4309653522169266784
4272105525224862312
4537834865612028449
...

result:

wrong answer 1st lines differ - expected: '7005218822778586245', found: '4722147791256619620'

Subtask #10:

score: 0
Wrong Answer

Test #93:

score: 0
Wrong Answer
time: 260ms
memory: 3640kb

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:

6487730230544547450
6558321576781822854
6280518351081706104
6105506455832386525
6053246559143565808
5931690463821647550
6570949608111361740
6626785096510629502
6416135695758924954
6437665974779496952
6634090988019362250
6546438099844904960
6487943385159008400
6471087006778487236
6414269418013129808
...

result:

wrong answer 1st lines differ - expected: '10107755825402443110', found: '6487730230544547450'