Submission #1038683

# Submission time Handle Problem Language Result Execution time Memory
1038683 2024-07-30T06:10:45 Z Warinchai COVID tests (CEOI24_covid) C++14
37.12 / 100
2071 ms 428 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
int n,t;
double p;
int use=0;
int ask(string v){
    //use++;
    cout<<"Q ";
    cout<<v;
    cout<<endl;
    //cerr<<"input:"<<endl;
    char ans;
    cin>>ans;
    //cerr<<ans<<endl;
    return ans=='P'?1:0;
}
string temp;
string ans;
void fans(int st,int en){
    //cerr<<st<<" "<<en<<endl;
    if(st>=en)return;
    int m=(st+en)/2;
    for(int i=st;i<=m;i++)temp[i]='1';
    bool tans;tans=ask(temp);
    for(int i=st;i<=m;i++)temp[i]='0';
    if(tans){
        if(st==m)ans[st]='1';
        else fans(st,m);
    }
    for(int i=m+1;i<=en;i++)temp[i]='1';
    tans=ask(temp);
    for(int i=m+1;i<=en;i++)temp[i]='0';
    if(tans){
        if(m+1==en)ans[en]='1';
        else fans(m+1,en);
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>p>>t;
    temp=string(n,'0');
    while(t--){
        //cerr<<"work"<<endl;
        ans=string(n,'0');
        use=0;
        int prob=p*n;
        int div=n/prob;
        //cout<<"prob:"<<prob<<endl;
        /*for(int i=1;i<=prob;i++){
            string t(n,'0');
            for(int j=div*(i-1);j<=(i==prob?n-1:div*i-1);j++)t[j]=1;
            if(ask(t))fans(div*(i-1),i==prob?n-1:div*i-1);
        }*/
        fans(0,n-1);
        cout<<"A ";
        cout<<ans;
        cout<<endl;
        char res;
        cin>>res;
        //cerr<<"use:"<<use<<endl;
        if(res=='W')break;
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:51:13: warning: unused variable 'div' [-Wunused-variable]
   51 |         int div=n/prob;
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 11 ms 344 KB Output is correct
4 Correct 13 ms 344 KB Output is correct
5 Correct 14 ms 344 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 6 ms 368 KB Output is correct
11 Correct 8 ms 344 KB Output is correct
12 Correct 9 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 7 ms 428 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 344 KB Output is correct (P=0.001, F=15.1, Q=17.7) -> 53.29 points
2 Correct 143 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=77.0) -> 29.73 points
3 Correct 259 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=149.0) -> 27.44 points
4 Correct 584 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=302.5) -> 27.12 points
5 Correct 724 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=387.5) -> 27.33 points
6 Correct 996 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=568.4) -> 28.05 points
7 Correct 1403 ms 344 KB Output is correct (P=0.104571, F=490.3, Q=750.4) -> 28.83 points
8 Correct 1689 ms 344 KB Output is correct (P=0.158765, F=639.1, Q=966.6) -> 29.51 points
9 Correct 2071 ms 344 KB Output is correct (P=0.2, F=731.4, Q=1111.6) -> 29.23 points