QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#339994#7768. Grievous Ladycinccout0 6ms3836kbC++141.6kb2024-02-28 11:24:322024-02-28 11:24:33

Judging History

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

  • [2024-02-28 11:24:33]
  • 评测
  • 测评结果:0
  • 用时:6ms
  • 内存:3836kb
  • [2024-02-28 11:24:32]
  • 提交

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(3);
    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;
        }
        ans=(__int128)suma*sumb;//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: 0ms
memory: 3568kb

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:

1131335100
808515774
1200394784
899763120
1018940208
1001435085
1467707192
1485038179
1238621594
1160924550
1015269381
702317441
1139666172
834569008
1269999522
845097900
1275686923
362593296
1186072830
859850286
742696367
768651003
821300736
1157629137
1022561155
1336232962
1360656850
898435776
114...

result:

wrong answer 1st lines differ - expected: '1356022774', found: '1131335100'

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

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:

9522692346
9595365862
9677166195
9737060902
9217122526
9455318214
10238707218
707222450*
1116812466(
10007652652
1205539876-
6073762356
9137060123
8945932160
9672680080
12898762651
1243436830*
10311131710
9068257595
1184692743(
7522187610
1093623417.
12368340880
9952544507
10070087476
9349332622
892...

result:

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

Subtask #3:

score: 0
Wrong Answer

Test #33:

score: 0
Wrong Answer
time: 0ms
memory: 3604kb

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:

10181781370,
99347866714
1152574701)0
9316094119)
1125133665)3
1147458216.,
1092356245/5
1121508957*0
1108803123/)
1256659331*6
104476578694
1096593179(+
1144253293)(
100768259206
1099608244*/
105108934554
1093399290(0
98526646250
9425505710.
10716335674(
1123382122)1
10271865917)
1275038902-,
12349...

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #37:

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

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:

278992318-4-+-).828(2
273039984,9-'51/+3*(.
289554652-(23*0+(6'.0
291921357).,)*54-*('9
311384171)78,*0005..7
274156657,4.593)5++.0
2970156490/7'2761-/20
311443890.0+91(-83-.0
267881492(15,719700+-
256817506),.+4'()09(,
206406382706,-+3206)8
19238103056)/51+*2,(,
296496568*+8980-,',*(
310618593.1976...

result:

wrong answer 1st lines differ - expected: '122583343290315160', found: '278992318-4-+-).828(2'

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 1ms
memory: 3836kb

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:

261890022*1*/-48506-97-022(3
270828041-78..9**5+4,072.415
242274869,'57/057,/7(.9740-0
228252044*54591)8746.(524+29
255083953('8+06.980,34834/,2
229619480,52,79.61/7920)434+
245673721.+747400/+)0,39.92/
2362345070.148/437'*35962./'
228564489-615*,901+01(14*5'/
23088592300-*+07.543/**6'''(
236700513,...

result:

wrong answer 1st lines differ - expected: '1024354444153173318804', found: '261890022*1*/-48506-97-022(3'

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

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:

10102829191.759)383/+0(
9426398223.0('50..2*86
9738091326(035)3+60+32
9422227764-9(/01/)*7)2
9838393226)30/(61,*0+0
958467801792'2/+,41669
9846430557/2+*6((9/61(
9351657201*/4.92+(-*23
946998265402/1120+091/
99467754453')4255//9.7
9877271051/,0288/*/00*
100428047043-0)7(/8'70+
95257860074,(.2(+(+08'...

result:

wrong answer 1st lines differ - expected: '10145178504143463639155', found: '10102829191.759)383/+0('

Subtask #7:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 2ms
memory: 3576kb

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:

1822403904686660,9,0/)859*102
1595958632,70+-20*(.1/''0598,
176425039226(.7/(73,8521,7)'0
18353474834+19(52,/.)006-0+79
17448923912-7'855+-06-/4*0062
1655896978(,*42-)/1)2236(759*
1817031389614)4)+.-0-(5'14,(0
1649415419-63177)7/09,9.50300
178178657541.,5/4-94'-9722/00
18460075276,'2+568)80*4.4*8*0
...

result:

wrong answer 1st lines differ - expected: '7370339999554792336414', found: '1822403904686660,9,0/)859*102'

Subtask #8:

score: 0
Wrong Answer

Test #73:

score: 0
Wrong Answer
time: 0ms
memory: 3652kb

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:

6305009285'''*)3-+5.897.97+.,
6416068051-8+,)1/*/6,5))64'02
62271692464*'')0000/96,03+557
62127678592'/02,1(0+7)/7)1/(/
657425544,08//(46/05(()1,401,
6079367128603*40073.00954/6'8
62121421528-0'-4,+9,6,.084800
6375350413'79-(+67)142.,039/0
656325443)3(81(((0-6'*/2.2+8(
602891975952-8-7)(30.(548-2*0
...

result:

wrong answer 1st lines differ - expected: '25099931872189852821766', found: '6305009285'''*)3-+5.897.97+.,'

Subtask #9:

score: 0
Wrong Answer

Test #85:

score: 0
Wrong Answer
time: 5ms
memory: 3680kb

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:

17562754266)*72,10-,8.54
1695077143,5*/'(816*(-/0
17530952884(9+07555,/0*2
17462298492+'(,02,')47)0
1805041676284++10,1*+/,*
172604167554,((302202+2.
179755160520.5/0.*83)21.
17465487063*./15(-''7/26
1761179619429(.'.54(/62,
178071453717*31,70)505-0
17402578828,4*.2'9.208..
173874914659,093,720+./,
...

result:

wrong answer 1st lines differ - expected: '7005218822778586245', found: '17562754266)*72,10-,8.54'

Subtask #10:

score: 0
Wrong Answer

Test #93:

score: 0
Wrong Answer
time: 6ms
memory: 3684kb

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:

253044869,,-3*0,'*003457
251553012)/)0,39-)8317/*
246672329.)025/*)83/9(22
256284418'))'1),+5(,7679
258694779-02215.0'0+++'0
247115794,*+6'96-6156+81
253149701/(/9524,*/566),
252058957-,-)+61'1.3*04*
2515581310/'-4788.8.'-89
252212602--(03'31'3*''+.
244282278-(.-098557+6'87
255209353(+052/-'55)3630
...

result:

wrong answer 1st lines differ - expected: '10107755825402443110', found: '253044869,,-3*0,'*003457'