QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#693054#9162. COVID testsRDFZchenyy12.95 3551ms23604kbC++145.6kb2024-10-31 15:26:342024-10-31 15:26:39

Judging History

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

  • [2024-10-31 15:26:39]
  • 评测
  • 测评结果:12.95
  • 用时:3551ms
  • 内存:23604kb
  • [2024-10-31 15:26:34]
  • 提交

answer

#include<bits/stdc++.h>

using ld=long double;

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

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){
//     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,0);
        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;
    // std::cin>>(b+1);
    Ithea::init();
    for(int i=1;i<=T;i++) Ithea::run();
    return 0;
}

详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 10
Accepted
time: 506ms
memory: 23552kb

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: 519ms
memory: 23596kb

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: 500ms
memory: 23476kb

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: 500ms
memory: 23480kb

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: 493ms
memory: 23472kb

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: 514ms
memory: 23480kb

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: 511ms
memory: 23480kb

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: 491ms
memory: 23484kb

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: 516ms
memory: 23540kb

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: 509ms
memory: 23544kb

input:

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

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #11:

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

input:

1000 0.380215 1
N
P
N
P
P
N
P
N
P
P
N
P
P
N
P
N
P
P
P
P
P
N
P
P
N
P
N
P
P
P
P
P
P
P
N
P
P
P
P
N
P
N
P
P
N
P
N
P
P
N
P
N
P
P
P
P
P
P
P
P
N
N
P
N
P
P
P
P
N
N
N
N
N
N
N
P
P
P
P
N
N
P
P
P
P
N
P
N
P
P
N
N
P
N
P
P
P
N
P
P
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
P
P
N
N
N
N
...

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #12:

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

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: 510ms
memory: 23488kb

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: 521ms
memory: 23480kb

input:

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

output:

Q 1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 1.0 1.0 translate:success

Test #15:

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

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: 698ms
memory: 23532kb

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: 12.95
Acceptable Answer

Test #18:

score: 16.76
Acceptable Answer
time: 740ms
memory: 23412kb

input:

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

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

points 0.18622222220 0.1862222222 Output is correct (P=0.001, F=15.1, Q=31.6) -> 16.76 points

Test #19:

score: 12.95
Acceptable Answer
time: 1051ms
memory: 23484kb

input:

1000 0.005256 300
P
N
P
P
P
N
P
P
P
P
N
P
P
P
P
P
N
P
P
P
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
N
P
P
P
P
P
P
P
P
N
N
P
N
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
N
P
N
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
P
P
P
N
P
N
P
P
N
P
P
P
N
P
P
P
P
P
P
N
C
N
N
N
N
P
N
P
P
P
N
P
P
P
P
...

output:

Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.14388888890 0.1438888889 Output is correct (P=0.005256, F=51.1, Q=127.1) -> 12.95 points

Test #20:

score: 15.24
Acceptable Answer
time: 1281ms
memory: 23548kb

input:

1000 0.011546 300
P
P
N
P
P
P
N
P
P
P
P
P
P
P
P
P
N
P
P
P
N
P
P
P
P
P
P
N
N
N
P
N
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
N
P
P
P
P
N
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
P
P
P
N
P
P
P
P
P
P
P
P
N
P
P
N
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
N
P
P
P
P
P
N
P
P
P
P
P
P
N
N
N
N
N
N
N
...

output:

Q 1111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.16933333330 0.1693333333 Output is correct (P=0.011546, F=94.9, Q=211.3) -> 15.24 points

Test #21:

score: 17.84
Acceptable Answer
time: 1717ms
memory: 23540kb

input:

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

output:

Q 1111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.19822222220 0.1982222222 Output is correct (P=0.028545, F=191.5, Q=385.1) -> 17.84 points

Test #22:

score: 17.78
Acceptable Answer
time: 2217ms
memory: 23600kb

input:

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

output:

Q 1111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.19755555560 0.1975555556 Output is correct (P=0.039856, F=246.3, Q=496.4) -> 17.78 points

Test #23:

score: 22.08
Acceptable Answer
time: 2587ms
memory: 23412kb

input:

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

output:

Q 1111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.24533333330 0.2453333333 Output is correct (P=0.068648, F=366.2, Q=647.9) -> 22.08 points

Test #24:

score: 28.52
Acceptable Answer
time: 2978ms
memory: 23604kb

input:

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

output:

Q 1111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.31688888890 0.3168888889 Output is correct (P=0.104571, F=490.3, Q=754.5) -> 28.52 points

Test #25:

score: 28.83
Acceptable Answer
time: 3551ms
memory: 23484kb

input:

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

output:

Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.32033333330 0.3203333333 Output is correct (P=0.158765, F=639.1, Q=978.1) -> 28.83 points

Test #26:

score: 40.94
Acceptable Answer
time: 3481ms
memory: 23544kb

input:

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

output:

Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

points 0.45488888890 0.4548888889 Output is correct (P=0.2, F=731.4, Q=950.5) -> 40.94 points