QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693153#9162. COVID testsRDFZchenyy90 2704ms23604kbC++145.6kb2024-10-31 15:37:592024-10-31 15:38:00

Judging History

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

  • [2024-10-31 15:38:00]
  • 评测
  • 测评结果:90
  • 用时:2704ms
  • 内存:23604kb
  • [2024-10-31 15:37:59]
  • 提交

answer

#include<bits/stdc++.h>

using ld=long double;

int n; ld p;
int T;
int a[1005]; char c;
char b[1005];
int CNT=0;

bool ask(int l,int r){
    std::cout<<'Q'<<' ';
    for(int j=1;j<=n;j++){
        std::cout<<(char)((j>=l&&j<=r)+'0');
    }
    std::cout<<std::endl;
    std::cin>>c;
    return c=='P';
}
// bool ask(int l,int r){
//     CNT++;
//     for(int i=l;i<=r;i++){
//         if(b[i]=='1') return true;
//     }
//     return false;
// }

void run(){
    memset(a,0,sizeof(a));
    for(int i=1;i<=n;i++){
        std::cout<<'Q'<<' ';
        for(int j=1;j<=n;j++){
            std::cout<<(char)((j==i)+'0');
        }
        std::cout<<std::endl;
        std::cin>>c;
        if(c=='P') a[i]=1;
    }
    std::cout<<'A'<<' ';
    for(int i=1;i<=n;i++){
        std::cout<<a[i];
    }
    std::cout<<std::endl; std::cin>>c;
    return;
}

namespace Sol1{
    int a[1005]; 
    void query(int l,int r){
        if(l==r){
            a[l]=1; return;
        }
        int mid=(l+r)>>1;
        if(ask(l,mid)){
            query(l,mid);
            if(ask(mid+1,r)){
                query(mid+1,r);
            }
        }else{
            query(mid+1,r);
        }
        return;
    }

    void run(){
        memset(a,0,sizeof(a));
        if(ask(1,n)) query(1,n);
        std::cout<<'A'<<' ';
        for(int i=1;i<=n;i++){
            std::cout<<a[i];
        }
        std::cout<<std::endl; std::cin>>c;
        return;
    }
}

namespace Sol9{
    void query(int l,int r){
        if(l==r){
            a[l]=1; return;
        }
        int mid=(l+r)>>1;
        if(ask(l,mid)){
            query(l,mid);
            if(ask(mid+1,r)){
                query(mid+1,r);
            }
        }else{
            query(mid+1,r);
        }
        return;
    }

    void run(){
        memset(a,0,sizeof(a));
        for(int i=1;i<=n-1;i+=3){
            if(ask(i,i+2)) query(i,i+2);
        }
        a[n]=ask(n,n);
        std::cout<<'A'<<' ';
        for(int i=1;i<=n;i++){
            std::cout<<a[i];
        }
        std::cout<<std::endl; std::cin>>c;
        return;
    }
}

namespace Ex{
    int pre[1005][2];
    ld f[1005][2];
    ld fpow(ld a,int b){
        ld ret=1;
        for(;b;b>>=1,a*=a) if(b&1) ret*=a;
        return ret;
    }
    void init(){
        f[1][0]=1; f[1][1]=0; 
        for(int i=2;i<=n;i++){
            f[i][0]=f[i][1]=1e18;
            for(int j=1;j<=i-1;j++){
                ld p1=((ld)1.0-fpow((ld)1.0-p,j));
                ld p2=p1/((ld)1.0-fpow((ld)1.0-p,i));
                if((ld)1.0+p1*(f[i-j][0]+f[j][1])+(1-p1)*f[i-j][0]<f[i][0]){
                    pre[i][0]=j;
                    f[i][0]=(ld)1.0+p1*(f[i-j][0]+f[j][1])+(1-p1)*f[i-j][0];
                }
                if((ld)1.0+p2*(f[i-j][0]+f[j][1])+(1-p2)*f[i-j][1]<f[i][1]){
                    pre[i][1]=j;
                    f[i][1]=(ld)1.0+p2*(f[i-j][0]+f[j][1])+(1-p2)*f[i-j][1];
                }
            }
            if(f[i][0]>1+((ld)1.0-fpow((ld)1.0-p,i))*f[i][1]){
                pre[i][0]=0;
                f[i][0]=1+((ld)1.0-fpow((ld)1.0-p,i))*f[i][1];
            }
        }
        return;
    }
    void query(int l,int r,int o){
        if(l==r){
            if(o==1) a[l]=1;
            else a[l]=ask(l,l);
            return;
        }
        int x=r-l+1;
        if(pre[x][o]==0){
            if(ask(l,r)) query(l,r,1);
        }else{
            int y=pre[x][o];
            if(ask(l,l+y-1)) query(l,l+y-1,1),query(l+y,r,0);
            else query(l+y,r,o);
        }
        return;
    }
    void run(){
        memset(a,0,sizeof(a));
        query(1,n,0);
        std::cout<<'A'<<' ';
        for(int i=1;i<=n;i++){
            std::cout<<a[i];
        }
        std::cout<<std::endl; std::cin>>c;
        return;
    }
}

namespace Ithea{
    ld f[1005][1005],g[1005];
    int pf[1005][1005],pg[1005];
    ld pl[1005];

    ld fpow(ld a,int b){
        ld res=1; for(;b;b>>=1,a*=a) if(b&1) res*=a; 
        return res;
    }
    void init(){
        f[0][0]=0,g[0]=0;
        for(int i=1;i<=n;i++){
            pl[i]=(1.0-fpow(1.0-p,i));
        }
        for(int i=1;i<=n;i++){
            pf[i][1]=0,f[i][1]=g[i-1];
            for(int j=2;j<=i;j++){
                pf[i][j]=-1,f[i][j]=1e18;
                for(int x=1;x<j;x++){
                    ld pn=pl[x]/pl[j];
                    ld val=1+f[i][x]*pn+f[i-x][j-x]*(1-pn);
                    if(val<=f[i][j]) f[i][j]=val,pf[i][j]=x;
                }
            }
            g[i]=1e18; pg[i]=-1;
            for(int x=1;x<=i;x++){
                ld pn=pl[x];
                ld val=1+pn*f[i][x]+(1.0-pn)*g[i-x];
                if(val<g[i]) g[i]=val,pg[i]=x;
            }
        }
        return;
    }
    void solve(int i,int j){
        if(!i) return;
        if(j==0){
            if(ask(n-i+1,n-i+pg[i])) solve(i,pg[i]);
            else solve(i-pg[i],0);
            return;
        }
        if(j==1){
            a[n-i+1]=1;
            solve(i-1,0);
            return;
        }
        int x=pf[i][j];
        if(ask(n-i+1,n-i+x)) solve(i,x);
        else solve(i-x,j-x);
        return;
    }
    void run(){
        memset(a,0,sizeof(a));
        solve(n,0);
        std::cout<<'A'<<' ';
        for(int i=1;i<=n;i++){
            std::cout<<a[i];
        }
        std::cout<<std::endl;
        std::cin>>c;
        return;
    }
}

int main(){
    std::cin>>n>>p>>T;
    Ithea::init();
    for(int i=1;i<=T;i++){
        Ithea::run();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 10
Accepted
time: 515ms
memory: 23480kb

input:

1000 0.789673 1
P
N
P
P
P
P
P
P
N
P
P
N
P
N
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
N
P
P
P
P
N
P
P
P
P
N
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
N
N
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
P
N
P
P
P
P
P
P
P
P
N
P
N
P
P
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #2:

score: 10
Accepted
time: 495ms
memory: 23480kb

input:

1000 0.686378 1
N
P
N
N
N
P
N
N
P
N
P
P
N
N
P
P
P
P
N
P
P
P
N
P
P
P
N
N
P
N
P
P
P
N
N
N
P
N
P
P
P
N
P
P
P
P
P
P
N
N
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
P
P
N
N
N
P
P
N
P
N
P
P
P
P
P
N
P
N
N
P
P
P
N
P
N
N
P
N
P
P
P
P
N
P
N
P
P
P
P
N
P
P
N
P
P
P
N
P
N
P
P
N
P
N
N
P
P
N
P
N
P
P
N
N
P
N
N
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #3:

score: 10
Accepted
time: 514ms
memory: 23600kb

input:

1000 0.873862 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
N
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #4:

score: 10
Accepted
time: 502ms
memory: 23476kb

input:

1000 0.669578 1
P
P
N
P
P
P
P
P
N
P
N
P
P
P
N
P
P
P
P
P
P
P
N
P
P
P
P
N
N
P
N
P
N
P
P
N
P
P
N
P
P
N
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
P
P
N
P
P
N
N
P
P
N
N
P
N
P
N
P
N
P
P
N
N
P
P
P
P
P
P
P
P
P
P
N
P
P
N
P
P
N
P
P
P
P
P
P
N
P
P
P
P
N
N
N
P
N
P
P
N
P
P
N
N
P
P
N
P
P
P
N
P
P
N
P
P
P
P
P
N
P
P
N
P
P
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #5:

score: 10
Accepted
time: 514ms
memory: 23540kb

input:

1000 0.907052 1
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
N
N
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #6:

score: 10
Accepted
time: 493ms
memory: 23528kb

input:

1000 0.844418 1
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
N
P
N
P
P
N
P
P
P
N
P
P
N
P
P
P
N
N
N
P
P
P
P
N
N
P
N
N
P
P
P
P
P
P
P
N
P
N
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #7:

score: 10
Accepted
time: 505ms
memory: 23600kb

input:

1000 0.533576 1
P
P
P
N
N
N
N
P
P
N
N
P
N
P
N
P
P
N
P
N
N
P
N
P
N
P
P
N
P
N
P
N
P
P
P
P
N
N
N
P
P
P
P
P
N
N
P
P
N
P
P
P
P
P
N
P
P
P
P
N
N
N
N
N
P
N
P
P
P
N
P
N
P
P
P
N
P
P
P
P
N
P
N
P
P
N
N
P
N
N
P
N
P
P
N
N
P
N
P
P
N
N
P
N
N
P
N
N
P
P
N
N
N
N
P
N
P
N
N
P
N
N
P
P
N
P
P
P
P
P
N
N
N
P
P
N
P
N
P
N
P
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #8:

score: 10
Accepted
time: 511ms
memory: 23480kb

input:

1000 0.415944 1
N
N
N
N
N
N
N
P
N
N
P
N
N
P
N
P
N
N
N
P
N
N
N
N
N
N
N
N
N
P
N
N
N
N
P
P
P
P
N
P
N
N
P
N
N
P
N
N
P
P
N
P
P
P
N
N
P
N
P
N
N
N
N
N
P
N
P
N
P
N
P
N
N
N
P
N
N
N
N
P
N
N
P
P
P
P
P
N
N
N
P
P
N
N
N
P
N
N
P
N
P
P
P
N
P
P
N
P
P
P
N
P
N
P
P
P
P
P
N
N
N
P
P
P
P
P
P
P
P
N
N
N
P
P
N
N
N
N
N
N
P
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #9:

score: 10
Accepted
time: 508ms
memory: 23484kb

input:

1000 0.596017 1
P
N
P
P
N
N
P
N
N
P
P
P
N
P
N
N
P
P
P
N
P
N
P
N
N
N
P
N
N
P
N
N
P
N
P
P
P
N
P
P
N
P
P
P
N
P
N
P
P
P
N
P
N
N
P
P
P
N
P
N
N
N
P
N
N
N
P
P
P
N
P
P
P
N
N
P
N
N
P
P
N
N
P
N
P
N
N
P
N
N
P
N
P
P
N
N
P
P
P
P
N
P
P
P
N
N
P
P
P
P
P
P
N
P
P
P
N
P
P
N
P
P
P
P
P
P
P
P
N
P
P
P
P
N
N
P
P
P
N
P
N
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #10:

score: 10
Accepted
time: 502ms
memory: 23548kb

input:

1000 0.157686 1
N
N
N
P
P
N
P
N
N
P
P
P
P
N
P
N
P
P
P
N
N
P
N
N
P
N
N
P
P
P
P
N
P
P
P
N
N
P
P
N
N
N
N
N
P
N
P
N
N
N
P
N
N
P
P
P
N
P
N
N
P
P
P
N
N
P
P
N
P
P
P
P
P
P
P
P
P
N
N
N
N
P
N
P
P
N
P
N
P
P
N
N
P
P
N
N
P
N
N
N
N
N
P
P
P
N
P
P
N
P
P
N
N
P
N
P
P
N
P
N
N
N
P
N
P
N
N
N
P
P
N
N
P
P
N
P
P
N
N
N
N
P
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #11:

score: 10
Accepted
time: 499ms
memory: 23484kb

input:

1000 0.380215 1
N
P
N
N
P
N
N
P
P
N
P
N
P
P
P
N
N
P
N
P
P
P
P
P
N
P
P
N
P
N
N
P
N
N
P
N
P
P
P
P
P
P
N
N
P
N
P
P
N
N
N
N
N
N
N
P
P
P
P
N
N
P
P
P
P
N
P
N
N
N
P
N
P
N
N
P
P
N
N
P
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
P
P
N
N
N
N
N
P
P
N
P
P
N
P
N
N
N
N
N
P
N
P
N
P
N
N
P
P
P
P
N
P
P
P
P
N
N
P
P
P
P
N
N
P
N
P
N
...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #12:

score: 10
Accepted
time: 509ms
memory: 23536kb

input:

1000 0.432565 1
P
N
P
N
N
P
N
N
N
P
P
P
N
P
P
N
N
N
N
N
N
N
N
N
P
P
P
N
P
P
N
N
P
P
P
P
N
P
P
N
N
N
N
P
P
P
P
N
P
N
N
P
P
P
N
N
N
N
P
N
P
N
P
N
P
N
P
P
N
N
P
N
N
P
N
N
N
P
N
P
N
N
N
P
N
N
P
N
P
N
N
N
P
N
N
P
P
P
P
P
P
N
P
N
N
N
N
N
N
N
P
P
N
P
N
N
N
N
P
P
P
N
P
N
N
P
P
P
N
P
P
P
P
P
P
N
P
N
P
P
N
P
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #13:

score: 10
Accepted
time: 513ms
memory: 23596kb

input:

1000 0.509199 1
P
P
N
P
N
N
N
P
P
N
N
N
N
N
P
N
N
P
P
N
P
P
N
P
P
P
P
P
N
N
P
N
P
P
N
P
P
P
P
P
P
P
P
P
P
N
P
P
P
N
N
P
N
P
P
N
P
N
P
N
N
P
N
P
N
P
N
N
N
N
N
P
P
N
N
N
P
P
P
N
N
P
P
P
P
N
N
N
N
P
P
N
P
N
N
N
P
P
P
P
P
N
N
N
P
P
N
P
P
N
P
N
P
P
P
N
N
P
P
N
N
N
N
N
N
P
P
P
N
N
P
P
N
N
N
N
N
N
P
P
N
N
...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #14:

score: 10
Accepted
time: 512ms
memory: 23524kb

input:

1000 0.381646 1
N
P
N
N
N
P
P
P
P
P
P
N
N
P
N
N
P
N
P
N
P
N
P
N
N
N
N
P
N
P
P
N
N
P
P
P
P
N
N
P
N
N
N
P
P
P
N
N
N
P
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
N
P
N
P
P
P
P
N
N
P
N
N
P
P
P
P
P
N
P
P
P
N
P
P
N
N
P
P
P
P
N
P
P
N
N
P
N
N
P
P
P
P
N
N
P
N
P
P
P
N
N
P
P
N
P
N
P
P
N
P
P
N
N
P
P
P
P
N
N
P
N
P
P
P
P
N
...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #15:

score: 10
Accepted
time: 514ms
memory: 23488kb

input:

1000 0.42815 1
N
P
P
N
P
N
P
P
P
N
N
P
N
N
P
N
N
P
P
P
N
N
N
N
P
P
P
N
N
N
P
P
N
P
N
N
P
N
N
N
P
P
N
N
N
N
P
N
N
P
P
N
P
N
N
N
N
P
N
N
N
N
N
P
N
P
P
N
P
P
P
P
N
N
N
P
P
P
N
P
P
P
N
P
P
N
P
N
N
N
P
N
N
P
N
N
P
P
N
P
P
N
N
P
N
N
P
P
P
P
P
P
P
N
N
N
P
N
P
N
P
N
N
N
N
N
N
N
P
N
N
N
P
N
P
P
P
P
N
N
N
P
N...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #16:

score: 10
Accepted
time: 695ms
memory: 23476kb

input:

1000 1 1
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P...

output:

Q 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #17:

score: 0
Time Limit Exceeded

input:

1000 0 1

output:


result:


Subtask #2:

score: 90
Accepted

Test #18:

score: 90
Accepted
time: 648ms
memory: 23596kb

input:

1000 0.001 300
N
N
C
N
P
P
N
N
P
P
N
N
P
P
N
C
N
P
N
P
N
P
N
N
P
P
P
P
P
N
P
P
N
P
N
P
P
P
N
N
N
P
N
N
C
N
N
C
N
N
C
P
N
P
N
P
N
P
P
N
N
N
C
N
P
N
P
P
N
P
P
N
P
P
N
C
N
N
C
N
N
C
P
N
P
P
P
P
P
N
P
P
N
C
N
N
C
N
P
N
P
N
P
N
P
N
N
P
P
N
P
P
P
P
N
N
N
C
N
P
P
N
P
N
P
P
P
P
N
P
P
N
P
P
P
N
P
P
P
N
P
P
P...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 1.0 1.0 Output is correct (P=0.001, F=15.1, Q=10.8) -> 90.00 points

Test #19:

score: 90
Accepted
time: 763ms
memory: 23472kb

input:

1000 0.005256 300
P
N
P
N
N
N
P
N
P
P
P
P
N
P
P
N
N
N
P
N
P
P
N
N
P
N
N
N
P
N
P
P
P
P
N
N
N
P
N
P
N
P
N
P
P
N
C
N
N
N
N
P
N
P
N
P
N
P
P
N
P
N
N
N
P
N
P
P
P
P
N
N
P
N
P
N
N
C
N
N
N
N
N
N
N
P
P
N
N
P
P
P
P
N
C
N
P
P
P
N
P
N
N
P
N
P
P
P
P
N
N
N
P
P
P
P
P
P
N
P
N
N
N
N
P
P
N
N
P
N
P
N
N
P
N
P
N
N
P
N
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.005256, F=51.1, Q=46.3) -> 90.00 points

Test #20:

score: 90
Accepted
time: 854ms
memory: 23600kb

input:

1000 0.011546 300
P
P
N
P
N
P
P
P
P
P
N
N
P
P
N
N
N
P
N
P
P
N
P
N
N
P
P
P
P
N
N
P
P
P
P
P
N
P
P
P
P
P
N
P
P
N
N
N
N
N
P
P
P
N
P
N
N
N
N
N
N
N
N
N
P
N
N
P
P
P
N
P
N
P
N
N
N
P
N
P
P
P
N
N
N
P
P
N
P
P
P
P
P
N
C
N
P
N
P
N
P
P
N
N
N
N
N
P
P
N
N
P
N
P
N
N
N
N
N
N
N
P
N
P
P
N
P
P
N
N
P
P
P
P
N
P
N
N
C
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.011546, F=94.9, Q=90.5) -> 90.00 points

Test #21:

score: 90
Accepted
time: 1113ms
memory: 23452kb

input:

1000 0.028545 300
P
P
P
P
P
N
N
N
P
P
N
N
P
N
N
P
P
N
N
N
P
P
P
N
N
N
N
P
N
N
N
N
P
P
P
P
N
N
N
P
P
P
P
N
N
N
N
P
N
N
N
N
N
P
N
N
N
P
P
P
N
P
N
N
P
P
N
P
N
P
P
P
N
N
N
P
N
P
P
P
P
P
P
P
N
N
P
P
P
N
P
P
N
P
N
N
N
P
N
N
N
P
N
N
P
N
N
N
P
N
N
N
P
N
P
N
P
N
P
P
P
N
N
P
N
N
N
N
P
N
N
N
P
P
N
N
P
N
P
N
P
...

output:

Q 1111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.028545, F=191.5, Q=187.7) -> 90.00 points

Test #22:

score: 90
Accepted
time: 1302ms
memory: 23408kb

input:

1000 0.039856 300
P
N
P
P
N
N
P
P
P
N
P
P
P
P
N
N
N
N
N
N
N
N
N
P
P
N
P
P
N
P
N
P
P
P
P
P
P
P
N
P
P
N
P
N
P
P
N
N
P
P
P
N
N
N
P
P
P
N
N
N
N
P
P
N
P
N
P
N
N
N
N
P
P
N
N
N
N
N
P
N
N
N
N
N
N
P
P
N
P
N
N
N
N
N
N
N
P
N
P
N
P
N
P
N
P
N
P
N
P
N
N
N
N
N
N
P
N
P
P
P
N
P
N
N
P
N
N
P
P
P
P
P
P
P
P
P
P
P
P
P
N
...

output:

Q 1111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.039856, F=246.3, Q=243.7) -> 90.00 points

Test #23:

score: 90
Accepted
time: 1782ms
memory: 23544kb

input:

1000 0.068648 300
N
P
N
P
P
P
P
N
N
P
P
N
N
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
P
N
P
N
N
N
P
P
N
P
P
N
N
P
P
N
P
P
N
N
N
P
P
N
N
N
P
N
N
P
N
P
N
N
N
P
P
P
N
N
N
N
N
N
N
P
N
N
N
N
P
N
N
N
P
P
P
P
P
P
P
P
P
N
P
P
N
N
N
P
N
N
N
N
N
P
P
P
N
N
N
P
N
N
P
P
P
N
N
N
P
N
N
N
P
P
P
N
P
N
P
N
P
N
P
N
N
N
P
N
P
N
P
...

output:

Q 1111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.068648, F=366.2, Q=364.2) -> 90.00 points

Test #24:

score: 90
Accepted
time: 2170ms
memory: 23488kb

input:

1000 0.104571 300
N
N
N
P
N
P
N
N
N
P
P
P
P
P
N
P
P
P
N
N
N
P
N
P
P
P
N
P
P
P
N
N
N
P
N
P
P
N
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
N
N
N
N
N
N
P
N
P
N
N
N
P
N
P
N
N
N
P
N
N
P
N
N
N
N
P
N
N
P
P
P
N
P
N
P
N
P
N
P
P
P
N
P
N
N
P
N
N
P
N
P
N
N
P
N
N
P
N
N
P
P
N
P
P
P
P
P
P
N
N
P
P
N
N
N
P
N
P
N
N
P
N
P
P
N
P
...

output:

Q 1111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.104571, F=490.3, Q=488.2) -> 90.00 points

Test #25:

score: 90
Accepted
time: 2618ms
memory: 23604kb

input:

1000 0.158765 300
N
N
N
N
P
P
P
N
P
P
N
N
N
P
P
N
P
P
P
N
N
N
N
N
N
N
N
P
N
N
P
P
N
N
N
N
N
P
P
N
N
N
N
P
P
N
N
N
N
P
N
N
N
P
N
N
N
N
P
N
P
N
N
N
P
N
P
P
N
P
N
P
P
P
N
P
N
P
N
N
N
N
N
N
P
P
P
P
P
P
P
P
P
N
N
P
P
N
N
N
N
N
N
P
N
N
N
N
P
P
N
P
N
P
P
P
P
P
P
N
P
N
N
N
P
N
P
P
N
N
P
N
P
N
P
P
N
P
N
P
N
...

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.158765, F=639.1, Q=633.1) -> 90.00 points

Test #26:

score: 90
Accepted
time: 2704ms
memory: 23524kb

input:

1000 0.2 300
N
P
N
P
N
P
N
P
P
N
P
N
N
N
N
N
P
N
N
P
N
P
P
P
N
P
N
P
P
N
P
P
N
N
P
N
P
N
P
P
P
N
P
N
P
P
P
P
N
P
N
N
P
N
N
N
N
N
N
P
N
N
P
P
P
P
N
P
N
N
N
P
N
N
N
P
P
N
P
P
N
N
N
N
P
N
P
P
N
P
P
P
P
N
N
N
N
P
P
P
P
P
N
P
P
N
N
N
P
N
N
P
N
P
P
N
P
N
N
N
N
P
N
P
P
P
P
P
P
N
N
N
N
P
N
P
N
N
N
P
N
P
N
N...

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 Output is correct (P=0.2, F=731.4, Q=729.3) -> 90.00 points