QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#74123#2122. Wystawa [A]wind_cross0 1204ms13920kbC++204.9kb2023-01-30 20:42:022023-01-30 20:42:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-30 20:42:04]
  • 评测
  • 测评结果:0
  • 用时:1204ms
  • 内存:13920kb
  • [2023-01-30 20:42:02]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize("Ofast", "inline", "-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include<bits/stdc++.h>
using namespace std;
inline char nc()
{
    static char buf[1000005],*l,*r;
    return l==r&&(r=(l=buf)+fread(buf,1,1000005,stdin),l==r)?EOF:*l++;
}
template <class code>inline code read(const code &a)
{
    code x=0;short w=0;char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=nc();}
    while(isdigit(ch)) {x=(x<<3)+(x<<1)+(ch^48);ch=nc();}
    return w?-x:x;
}
void print(__int128 x){
    if(x<0)putchar('-'),x=-x;
    if(x>=10)print(x/10);
    putchar(x%10+48);
}
int a[100005],b[100005],n,k,xz[100005],c[100005];
long long xd[400005],tag[400005];
int xd1[400005];
void push_down(int root){
    if(!tag[root])return;
    int lc=root<<1,rc=root<<1|1;
    tag[lc]+=tag[root];tag[rc]+=tag[root];
    xd[lc]+=tag[root];xd[rc]+=tag[root];
    tag[root]=0;
}
void upd1(int root,int x,int zl,int zr,int v){
    if(zl==zr){
        xd1[root]=v;
        return;
    }
    int mid=(zl+zr)>>1;
    if(x<=mid)upd1(root<<1,x,zl,mid,v);
    else upd1(root<<1|1,x,mid+1,zr,v);
    xd1[root]=max(xd1[root<<1],xd1[root<<1|1]);
}
int cx1(int root,int l,int r,int zl,int zr){
    if(zl>r||zr<l)return -2e9;
    if(zl>=l&&zr<=r)return xd1[root];
    int mid=(zl+zr)>>1;
    return max(cx1(root<<1,l,r,zl,mid),cx1(root<<1|1,l,r,mid+1,zr));
}
void upd(int root,int l,int r,int zl,int zr,int v){
    if(zl>r||zr<l)return;
    if(zl>=l&&zr<=r){
        xd[root]+=v;
        tag[root]+=v;
        return;
    }
    push_down(root);
    int mid=(zl+zr)>>1;
    upd(root<<1,l,r,zl,mid,v);upd(root<<1|1,l,r,mid+1,zr,v);
    xd[root]=max(xd[root<<1],xd[root<<1|1]);
}
long long cx(int root,int l,int r,int zl,int zr){
    if(zl>r||zr<l)return -1e18;
    if(zl>=l&&zr<=r)return xd[root];
    push_down(root);
    int mid=(zl+zr)>>1;
    return max(cx(root<<1,l,r,zl,mid),cx(root<<1|1,l,r,mid+1,zr));
}
int ef(int root,int zl,int zr,long long v1,long long v2,int v3){
    if(zl==zr){
        
        // if(zl==15)printf("%lld\n",cx(1,1,zl,1,n)-cx1(1,zl,n,1,n)-cx(1,zl+1,n,1,n));
        if(max(v1,xd[root])-max(v3,xd1[root])<=v2){
            
            return zl;
        }
        return 0;
    }
    push_down(root);
    int mid=(zl+zr)>>1,lc=root<<1,rc=root<<1|1;
    long long n1=max(v1,xd[lc]),n2=max(v2,xd[rc]),n3=max(v3,max(xd1[rc],b[mid]));
    if(n1-n3<=n2){
        int fx=ef(root<<1|1,mid+1,zr,n1,v2,v3);
        if(fx==0)return mid;
        return fx;
    }else return ef(root<<1,zl,mid,v1,n2,max(v3,xd1[rc]));
}
int ef1(int root,int l,int r,int zl,int zr,int hg){
    if(zl>r||zr<l||xd1[root]<hg)return -1;
    if(zl==zr)return zl;
    int mid=(zl+zr)>>1;
    if(zl>=l&&zr<=r){
        if(xd1[root<<1]==hg)return ef1(root<<1,l,r,zl,mid,hg);
        return ef1(root<<1|1,l,r,mid+1,zr,hg);
    }
    if(r<=mid)return ef1(root<<1,l,r,zl,mid,hg);
    else if(l>mid)return ef1(root<<1|1,l,r,mid+1,zr,hg);
    int fx=ef1(root<<1,l,r,zl,mid,hg);
    if(fx==-1)return ef1(root<<1|1,l,r,mid+1,zr,hg);
    return fx;
}
long long getz(int x){
    if(x==0)return 1e18;
    // printf("%lld %lld %lld ",cx(1,1,x,1,n),cx1(1,x,n,1,n),cx(1,x+1,n,1,n));
    return max(cx(1,1,x,1,n)-cx1(1,x,n,1,n),cx(1,x+1,n,1,n));
}
int check(long long x){
    memset(xd,0,sizeof(xd));
    memset(xd1,0,sizeof(xd1));
    memset(tag,0,sizeof(tag));
    int sc=0;
    for(int i=1;i<=n;i++)c[i]=max(b[i]-a[i],0),xz[i]=0;
    for(int i=1;i<=n;i++){
        upd(1,1,i,1,n,b[i]);
        upd1(1,i,1,n,c[i]);
        while(xd[1]>x&&sc<i){
            int wz=ef(1,1,n,-1e18,-1e18,-2e9);
            --wz;
            // if(wz<i)while(cx1(1,wz,n,1,n)!=c[wz])++wz;
            // printf("%d %d\n",wz,cx1(1,wz,n,1,n));
            if(wz<0)wz=1;
            wz=ef1(1,wz,i,1,n,cx1(1,wz,n,1,n));
            if(wz<i&&getz(wz)>=getz(wz+1)&&c[wz+1]>0)++wz;
            // printf("%d %d %d %d %lld %lld\n",wz,i,c[wz],cx1(1,wz,n,1,n),xd[1],getz(wz+1));
            upd(1,1,wz,1,n,-c[wz]);c[wz]=-2e9;upd1(1,wz,1,n,c[wz]);xz[wz]=1;
            ++sc;
        }
        if(xd[1]>x||sc>k)return -1;
    }
    return sc;
}
signed main()
{
    // freopen("text.in","r",stdin);
    // freopen("text.out","w",stdout);
    n=read(n),k=read(k);
    int fg=0;
    for(int i=1;i<=n;i++)a[i]=read(a[i]);
    for(int i=1;i<=n;i++){
        b[i]=read(b[i]);
        fg+=(a[i]<=b[i]);
    }
    int op=0;
    if(fg<k){
        op=1;
        k=n-k;
        for(int i=1;i<=n;i++)swap(a[i],b[i]);
    }
    long long l=0,r=1e14,kx=1e14;
    while(l<=r){
        long long mid=(l+r)>>1;
        if(check(mid)!=-1)kx=mid,r=mid-1;
        else l=mid+1;
    }
    printf("%lld\n",kx);
    // return 0;
    int sy=k-check(kx);
    for(int i=1;i<=n;i++){
        if(xz[i]^op)putchar('A');
        else if(a[i]<=b[i]&&sy){
            putchar('A');
            --sy;   
        }else putchar('B');
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 12760kb

input:

6 2
-1 7 0 2 -5 0
3 1 4 -3 -3 12

output:

5
ABBBBA

result:

wrong answer read 5 but the jury's answer is 4

Subtask #2:

score: 0
Wrong Answer

Test #28:

score: 1
Accepted
time: 19ms
memory: 11284kb

input:

80 15
-806772 -117802 266998 190197 -579000 615552 862955 -727153 870975 433653 583521 996193 563471 -615416 -924633 -296705 258551 -962057 -516030 -639148 -196720 656594 -667491 179513 98453 732582 -656179 525953 -955189 -711999 -708631 -6539 198681 -390094 611214 473002 -685751 787723 -511023 -183...

output:

1000383
ABABABBABBBBAAABBBBABBBBBBBBBABBBBBBBBBBBBBBBBABBBBBBBABBBBBBBBBBBBBBBBAABAABBBB

result:

ok correct answer and good plan!

Test #29:

score: 0
Accepted
time: 13ms
memory: 11328kb

input:

80 27
928779 -754470 -813332 -405414 -349390 -434427 705066 595688 -863781 578598 652744 850802 29480 441561 -872297 815242 353316 -355334 37328 -874346 -722719 -62461 -650942 -286428 -899854 151553 -382903 392123 -352713 721952 -552143 358498 -947110 -505541 -72903 -324323 216970 684948 715042 -738...

output:

1250993
BABABABBABABBBAAABAAABBBABABABAAAAAAABABBBABBBBBBBBBBBBBBBBBBBBABBABAABBBBBBBBBB

result:

ok correct answer and good plan!

Test #30:

score: -1
Wrong Answer
time: 14ms
memory: 12260kb

input:

80 45
69594 17146 55793 -999416 -637207 338604 752539 428350 -677453 878359 701201 784328 -611799 -865683 -793199 417853 -329841 172472 -872731 -956337 358692 -729361 -919696 807513 75078 981786 586400 -314267 640745 5673 120163 311787 -433336 -494543 627480 -943048 -315355 -34937 -156968 161067 -17...

output:

977858
BBAAABBAABBBBAABAAAABAABABBBBBBBAABAABABBABABABAAAAABBBAAAAAAABAAABAAABABAAABBAB

result:

wrong answer read 977858 but the jury's answer is 901102

Subtask #3:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 14ms
memory: 11596kb

input:

400 35
282603 437907 189144 -306523 875091 -129096 135690 959139 919604 -510810 18016 -898443 -410507 -528852 -639057 503910 461833 267527 244577 -103136 -909424 -892963 -870210 -89935 509282 -930568 808009 773531 257190 -828648 -861529 -970580 -539999 260846 -620133 -979364 640196 388456 491785 -81...

output:

1480772
BBBBBBABBBBBBBBBBBBBBABBBABBBBBBABBBBBBBBBBBBBBABBBBABBAABBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAABBABBBBABBABBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBABBBABBBBBBBBBBBBBBBBABBBBBBABBABBBBABBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBB...

result:

wrong answer read 1480772 but the jury's answer is 1451726

Subtask #4:

score: 0
Wrong Answer

Test #70:

score: 1
Accepted
time: 28ms
memory: 11572kb

input:

2000 196
53359475 -389458277 27443906 213187393 525501489 -563370396 -780381693 990456678 -966127727 -926000233 -208464373 99915107 429573188 471624215 -533030054 790604637 -643361957 -590004012 412092763 -856885908 -857464588 176819165 -218862254 802719311 794718647 525976558 341493086 692047249 14...

output:

2939757937
AABBABABAAAAABAAAABAABABBABBABABAABBBABABABAAABAAABABABBBBAABBBABBAAAABBBBABAAABBABAAABBBAAAABABAABBBBAABBAAABBAAAAAAABBBBABAABAAABAAABAAAAABBABAABABBABBBBBBAABBABBAAABABAABAABABBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct answer and good plan!

Test #71:

score: 0
Accepted
time: 28ms
memory: 11940kb

input:

2000 620
-440775853 475665691 380498790 -481751408 -681829352 -466284677 -329805774 912951785 -482165317 -129240263 849212701 580279966 -707232219 -293262926 600453383 74492327 -864164800 440292860 46322716 240344970 -288767901 834253329 830096007 -858195654 -758714746 -146011182 709555860 -33174157...

output:

3090280208
BBAAABABABBBAABAABABBBBAAABAAAAAABBABABBBBBABABBBAAABABBBABABBBBBABABABBBBBAAAAABBABAABBABBBABBABBBBBAABAABBABAABBABBAABABAABABABBBBABABBBBBABAABBABBABBBBAAABAABAAAAAABABBBBAAABBBABAABBBAAAAABAAABAABBABBABBABBBABBABBBABBABAABBAAAAABABABAABBBBBBBBBBABABAAAAABBAABABBBAABBABBBBBAABBBBAAAABAB...

result:

ok correct answer and good plan!

Test #72:

score: -1
Wrong Answer
time: 34ms
memory: 11784kb

input:

2000 1024
675321968 -997906280 764040934 997069947 960509735 776113777 -269803295 570018698 513577670 571913563 -656637233 -600659238 207839877 -156602638 609883255 -641619983 -885606495 372943748 582906686 412883431 479289934 -486922266 907501688 331234825 664421781 -106988269 -631352180 608747796 ...

output:

2927194261
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

wrong answer you didn't select excatly k elements in the first array!

Subtask #5:

score: 0
Wrong Answer

Test #91:

score: 1
Accepted
time: 83ms
memory: 11576kb

input:

8000 819
-80520 58858 -66529 -89399 -29326 -30844 -11574 101653 -19630 11590 -82857 -41398 47160 -103616 -72194 58679 39849 -58831 -74715 -21618 -42309 -108923 -62472 88514 82625 -38663 17205 -19790 -88376 -108625 67220 -93508 72195 72062 55863 118603 -58888 75786 -113297 -53630 -24366 119300 19571 ...

output:

323537
ABBAAAABABAABAABAAABBAABAABAAAAABABBAAABABBBABBBAAAABAAABAABBBABBABBBBABABBABBBABBBAABABAABBBBBABAABAAAAABBBBBBAAABBBAAABBAAABAABBABBABBBBAABBABABABABBAAABABABAAABBBBABBBAABBABBBABBBABBAAAAABAAABBAAABBBBBAAAAAABAAAABABABBBBBBBABBBABABAABBBBBABABBBAAABAABBAABAAABBAAABBBBBBBAAAABBBBBBBABABAABAB...

result:

ok correct answer and good plan!

Test #92:

score: -1
Wrong Answer
time: 84ms
memory: 12148kb

input:

8000 2647
38642 46138 36494 -42389 -95522 81653 -95362 21680 -951 93428 -67784 99778 117299 27429 -86811 -57996 70448 116447 10946 86304 38209 102184 3975 52506 -87847 68023 103894 101483 18155 -3659 -107034 -52931 79264 -23536 -86613 -109688 95333 116658 54939 115102 -50734 -18122 89517 -116770 -77...

output:

320735
BAABABABAAABBBAABBABBBBABBBBBAAABAAABBBBAABAAABABBBBAAAAAAAAABBABBBAABBBAABAABABAAAABABABAABBBAAABABAAABBAABAABAAABAAABAABABBABBBAAABBABAABBAAAAAABBABAAABAAABBBBAABABBBBABABAAABBBBBBBBBAAABBBABBAABBAAAABABABAABBBBABABAABABAABAABAABBBBABAAABBBBBAABAAABBABAABBABAABBBBAABABBAABABAAABABABAAABAAAA...

result:

wrong answer read 320735 but the jury's answer is 312702

Subtask #6:

score: 0
Wrong Answer

Test #113:

score: 1
Accepted
time: 291ms
memory: 12156kb

input:

25000 2601
684640294 598432913 -623227598 -736881259 -283494811 310898894 999454243 606030163 480256573 -699956166 388593535 -71688332 824098087 -969996868 53222581 730834964 -294074303 -949074306 -245586236 -170646877 -543582352 -466099725 -422182532 218666222 -822502298 -448284895 465111319 550729...

output:

2987102435
BBAAABBBBABABABBBAAAAABBAAABAAABAAAABAABBBAABBABAABBABBBBAABBABBAAAABABABABBABBBAAABABBBAABBBBAABAAABAAABAABAAAABAABABBAABBBBABAABBAABBBAAABBBAABBBBAAAAAABBBAAAAABAABBBBBABBABABAAAABBABBABAAAABAABAABBAAABABAAABBBBBABABABBBABBBABBAABBABAABBBBABAABABAAABABBABABABABBAABAAAABBABAABAABAABAABBA...

result:

ok correct answer and good plan!

Test #114:

score: -1
Wrong Answer
time: 216ms
memory: 12300kb

input:

25000 8178
190504966 -875139058 -756352298 568179941 -641155725 581744768 -454363695 189829332 14056645 -50679842 -41948815 -762237201 -312707320 -833336580 210136099 552779740 -514877146 -66261080 -73299197 978461503 -899578082 191334439 678653231 384666619 -913186188 367946789 -823919219 -17449193...

output:

3872892598
BBAAABABAAAABABBAAABABBAABAABBBAAAAAABABBABBAAAAABABAABBAABBBBBABBAAABBAABBBAAABABBBABBAAABBBBABBBAAAABBABAABAAAAAAAAABAAAAABAAAABBBABBBABABABABABAABBAABAAABBBAABBBBBAABABAAABBBAABBBBABBAAABABBABBBBBABABBABBABABBBABBBABBABABAABBABBABBBAAAAAAABBBAAABBABABAABABAABBBBAAAAAABBABBABBBBBBABABBA...

result:

wrong answer read 3872892598 but the jury's answer is 3628981392

Subtask #7:

score: 0
Wrong Answer

Test #134:

score: 1
Accepted
time: 383ms
memory: 13084kb

input:

50000 5073
401620049 252597114 638998890 -773942367 -994194991 773972290 755430111 -523539687 -749222285 70295502 406924746 -866460865 -321006536 -20842814 -717101098 238603919 -973981419 -263358138 341137321 -595132691 346299278 -897934865 -155536848 753555039 -925676770 -262539063 -447140814 22418...

output:

4159789614
BABAABBAAABAABABAABAAABBAABBABBBBBBBBBABABBBBABAAABBBBBAABABBBBAAABBAABBAABAAAAAAAAAAABBABBBAABAAAAAAABBBBABAAABABAABAABBBAAAABABAABBBAABBABBBAABABBABBAAAAAABBABBBBAAABBBABABABBAABBBAAABAABBBABBABBBBABBBBAAABAAAABBAABAABAABBAABABBAAAABAAABBAAAABBABBABBBAABABBBABAABABBBABABBBBAAAABABBABBBA...

result:

ok correct answer and good plan!

Test #135:

score: 0
Accepted
time: 449ms
memory: 13012kb

input:

50000 16491
54968367 631541498 992053774 166821902 -227802340 68248245 667948944 -89264003 -265259875 -594887443 926544734 -411696999 30407481 -421433024 416382339 -477508391 805215739 255289229 -974795064 89186347 -425870885 -240500701 -277492315 -907359926 -479110162 236386925 -738211191 -64852475...

output:

3518512257
BBBAABBBAABBBABBBBABAAAAABAABABBBBBABABABAABAAABABBBABABAABABAAAABBABAAAABABABBAABBAAAAAABBAAABABBAABABABBABBBBBBBABBBBBBBBAAABBBAABBBBBABABBABBBBABAAABABBAABBBBBBAABBBBBBBBAAABBAABABBBAAAABAAABBBBBAAABBABBAAAABABABAABBBBABABBAABBBBBABABAABAABBABBBAABAABAAAABAAAAABABABABBBBABAABBABAAAABBB...

result:

ok correct answer and good plan!

Test #136:

score: 0
Accepted
time: 566ms
memory: 13740kb

input:

50000 24828
537402958 -867631466 399025999 157423833 391106665 312817610 580467777 -943977667 -731459803 -431790703 908914224 554847444 945479577 201406848 573295857 806379300 783774044 -350116969 998130828 -275525690 194703304 -47855879 823343448 845728632 944026365 -947381392 -908205503 89003346 -...

output:

3866929582
BABABABAABBBBBBBAABABBABBBABABBBAABAABBBABBBABBBABABABBAAAAABBAAABAABAAABABBAABABABBBAABBBABABAAAAABABBAABAABBAAABABABBAAAAABABAABAABBAABABBBABBBBAABAABAABAABBABBBAAABABBABBBBAABBBBABABBABABBAABAABABABAAABAABAAABBAABABAAAAAAAABBAABBBAABBABABAAABBBBBAABBAAAAAABABBBBBAAAABAAAABABABABABAAAAB...

result:

ok correct answer and good plan!

Test #137:

score: -1
Wrong Answer
time: 639ms
memory: 13608kb

input:

50000 33421
676930860 -488687082 413384945 -976027801 180929397 384302336 614869263 -509701983 -247497393 217485621 478371874 -626091760 -139448328 177786 70945152 -446983508 76791617 -981124160 -317801557 -102987229 910883637 609578285 435959787 525549445 -634876949 -448455404 288943544 244745715 -...

output:

3596500550
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

wrong answer you didn't select excatly k elements in the first array!

Subtask #8:

score: 0
Wrong Answer

Test #156:

score: 1
Accepted
time: 677ms
memory: 13760kb

input:

80000 7878
777864027 -240722331 387404961 -663519829 -216544675 -615470669 389523326 -655149376 147392262 -473912099 -138402122 -464043161 559358763 -559101596 -823274287 110669805 -604050872 544371755 -438475893 567469656 820006475 817713642 888317607 -538471506 971148759 -445976429 128957549 -1023...

output:

3874967607
BABAAABABAAABAABABBABBBABABBBBBABAABAAABAAABBAAAABBAAABBABABBBBABBBABABBAABBBAABBAAABBABBABABBBABBBBBABABAABAAABAAAAABABBBBBBBAAAAABBBAAAABBAABABBABBBABABAABBABBABBABBABABABAABABABBBBAABBAABBBAABBBABAAABAAAAABBBABAABAAABABBAABABBABABBABABABABBAAAABBABBABBBABAAABBBBBAAABBABAAAAABBABABAABAB...

result:

ok correct answer and good plan!

Test #157:

score: 0
Accepted
time: 1034ms
memory: 13576kb

input:

80000 26630
-228051878 771885283 254280261 763424024 549847976 479444139 -209738418 -680776767 -856864752 175364225 -130431639 502501282 -429962998 -422441308 -813844415 345526421 836450348 -425331374 98108077 202757619 -611296839 -989641537 475332953 -346870116 -582284634 -606314664 -188520409 -975...

output:

3801583361
ABABABAAABBBBAABBAABAABAAAAABBBABBABAAAABAABBBBBAAAABAABBBABAAAABBBBBBBBBBBABAABBBAAAABAABBABBABBAAAABBAABBAABBBAABBAAAAAABAAABAABBAABBBBBABAAAABABABBABBBBBABBBBABBABBBABAABBBBBBBAABAAAABBABBBBABBBAAABBBBBABBBABAABBABABBBAABABBABBABABABABBBBAABAABBBBABBBBBBABAABBAAABABAABAAABBAABBAAAAAABB...

result:

ok correct answer and good plan!

Test #158:

score: 0
Accepted
time: 890ms
memory: 13576kb

input:

80000 39764
401866359 127399585 147432070 120362725 -831243020 -737929411 -297219585 924412645 113277242 876518051 927245435 -678437922 -538320984 -675547872 319639022 -223102243 615647505 969262429 244118607 323418578 -819808923 -332207373 -423831285 -958078490 840851893 921058745 -843887717 -23754...

output:

3554018068
BABAABABBBBAAABBBBAAABAABAABBBABABBAABBBAABBBAAABAAAABBBAAAAAAABABBAABBBABBAAABAABBABBBBAABBABAAAABBAAAAABBABAABAAABBBBBBBBABAAABBABABAABAABBABAABBABABABAAABBBABBBBAAAABBBBBBABABABBABBAAABABAAAAABBABBAABAAABAABAAAABAAABAABBAAABAABBBBBABAAAAABABAAABAABABBBBBBBAABBABABBBBBBBBBAAABBBBBBAAAAB...

result:

ok correct answer and good plan!

Test #159:

score: -1
Wrong Answer
time: 624ms
memory: 13724kb

input:

80000 53449
541394261 142047038 14307370 110964656 446799136 847375732 -262818099 846907752 -839102270 -474205626 423435341 288106521 351150119 -52708000 476552540 -939214553 56148724 363856231 268922000 -15692466 -251112236 837007368 503244323 -766477100 -200800923 396554651 -623308589 -81803460 47...

output:

3494197937
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

wrong answer you didn't select excatly k elements in the first array!

Subtask #9:

score: 0
Wrong Answer

Test #178:

score: 1
Accepted
time: 1073ms
memory: 13864kb

input:

100000 10047
-5502 -308 7976 6352 -3142 -4377 528 1970 944 2448 8449 -4615 2083 4754 4525 -679 9798 -441 3115 5770 9575 6992 90 6051 -5122 70 -7052 2254 8847 2273 9231 9556 -8342 7092 -8287 -5179 -7231 -5016 4408 -4634 -1591 -6752 2148 2256 -9048 7607 553 -2994 -3081 -1207 3352 -578 8193 9903 7113 -...

output:

39002
BBABBAABABBABBBABBABBABAAAAABABBABABAABAAABAABBAABABBBBBAAAAABAAABBBABBBBABBBABABABABBBBAABABAAAABABABBABAAABAABABBBBAABAAAABBBBBABBAAABAABBBABABABBABAAABAAAABBAAAABAAABBBBAAABAAABABBBBBAABABBBABABBABBBABBAAAAAABBBBAABBAAAABBABBAABAABABBAAAAAABBABBBABAAAABAABBBBABBBABAAAAABABAABABABAAAABBAAAAB...

result:

ok correct answer and good plan!

Test #179:

score: 0
Accepted
time: 896ms
memory: 13776kb

input:

100000 32886
5333 -3595 -1881 -8757 3537 -793 8663 8013 -91 -7691 -4715 8299 -1897 1414 -7739 2513 8661 -2279 -6923 -8860 1912 -2346 -9288 7771 4557 -3350 -6539 -919 -3837 -7992 -9004 -4877 6627 9457 1921 5647 -7696 -325 -2407 -7104 3516 2446 -2096 522 8191 5832 -1365 9613 7629 5280 -2933 -2037 -261...

output:

40458
AABABABBBABBAAAAABAAAABBBAAAABAABBBBAAAABBABBBABBBAABBABAABABABBBBBBBABBAABABBABAABBBBABAABBAAABBBAABAABAAAABABBAAAABABBAAABAAABABBBAABBBBABBBBABBBBBAABABABAABAABBBAABAABAAAABBAAAAAAABBBBABBABABBABABBABAAAAAABAABBAABAAABAABABAABAABAABBAAABBBBBABBBABBBBAABAABABBABBAABABABAAAABBBAABBBABAABABBAAB...

result:

ok correct answer and good plan!

Test #180:

score: 0
Accepted
time: 1031ms
memory: 13864kb

input:

100000 50008
8249 9637 -7746 -3930 -2461 -401 -1387 1974 6078 -5563 2988 -2510 3588 7029 -2 -1499 4397 6689 -3774 2579 9643 5991 -4648 -6042 8763 -1317 -4275 -5758 -4319 1214 -8699 2682 4482 8610 -3795 -2933 3360 -2687 -6961 -6567 -2713 9893 5332 539 -639 8405 -686 -5376 -7881 -4157 -6091 -9479 -435...

output:

38963
ABBABBABBABBAAAABBAABBAABABABBABBBABBAAABBBBBBAAAAAABABBBAABABBABAAABABAABBABAAAABABABBAABABBBABBBBBBBBBAABBAABBAABAABBAABBAAAABAABABBBABBBAAAAABBAABBAABBAAABBAAABBBAABBBBBAABAAABBBABAAAABABBBBBABABBABAAABABBBBAABBABABBBBBBBBBABABBABBBBAABBBAAABAABBAAAAABBAABBBABBABBABBAABBBABBBABAABAAAAAAABAA...

result:

ok correct answer and good plan!

Test #181:

score: -1
Wrong Answer
time: 739ms
memory: 13800kb

input:

100000 67154
2210 -854 -2480 1492 736 4339 4487 7151 5043 -3435 -8185 -6115 1869 3094 -3071 -5511 6116 6582 6189 7950 1385 -3942 522 1897 -8763 -4737 -3762 9319 -1319 -1847 5864 -6873 3798 8358 -165 -8626 2895 2004 7976 -6181 133 -910 -2634 1066 -3401 -7898 -8077 -4441 8302 6407 -325 -6590 -6679 -13...

output:

42108
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

result:

wrong answer you didn't select excatly k elements in the first array!

Subtask #10:

score: 0
Wrong Answer

Test #198:

score: 1
Accepted
time: 1057ms
memory: 13920kb

input:

100000 10184
897364269 894652505 421467601 -125369057 974459026 -179714212 582271101 448643533 643614224 628078404 484256779 -635646600 -559936755 337166672 300228846 50900132 -792820304 -300878123 -67707471 -746291314 157318792 -311384832 -239695088 218211183 -159892602 67981542 252575782 580382287...

output:

3372235692
ABAABABBBBBABBBAABBAAAABBAABABBBABABBBBABAAAAABAAABBABBABBBABBAAABBBBBBBBAABBAABABBAABBABABAABABABABAAAABABAABBBBBBBBAAABABABABBAAABABBAABBBBBBBAAAABABABBAAABAAAABBAAABBAABBAABABAABBAABABABBBAAAABAABABBBABBABBABBBBBAAABBABBBBAAABABBBABABBBAAABAAAABAABBABBBBBAAAAAAABABAABABABBAAABBBABABBAB...

result:

ok correct answer and good plan!

Test #199:

score: -1
Wrong Answer
time: 1204ms
memory: 13836kb

input:

100000 32893
550712587 -726403112 774522485 -186644628 -406631970 -446925424 494789934 544223279 -872423367 -575161627 -996123234 183414197 768047181 84060108 -713771364 -690813171 -814261999 581935103 416998997 402817066 777892981 -655990508 -214166909 -904646696 -736756076 -604006198 963545245 883...

output:

4428710845
BABBAABBAAABBBAAABBAAAAABABBABAAABBAAABBABBAAAABABBAABBABBBBBBAABAAAAAAABAABBBAABBBABBBBABBABBABAABAABAAAABBABBBABAABAAAABBBBABAAAAABAAAAABBBABABABBAAAAAABBABABBBAABBABABBAABABBAABBABABABABBABBBBABBBBBBBABBAABBAABBABBAAABABAAAAABAAABBABBBBBBBABBABABAABAABBABABBAABAAABBAABABBABABAAABBBBAAB...

result:

wrong answer read 4428710845 but the jury's answer is 4141014867