Submission #1042095

# Submission time Handle Problem Language Result Execution time Memory
1042095 2024-08-02T14:24:44 Z Warinchai COVID tests (CEOI24_covid) C++14
46.77 / 100
1758 ms 2248 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
int n,t;
double p;
int use=0;
map<string,int>mp;
int ask(string v){
    if(mp[v]!=0)return mp[v]-1;
    //use++;
    cout<<"Q ";
    cout<<v;
    cout<<endl;
    //cerr<<"input:"<<endl;
    char ans;
    cin>>ans;
    //cerr<<ans<<endl;
    return (mp[v]=(ans=='P'?1:0)+1)-1;
}
int ask(int st,int en){
    en=min(n-1,en);
    string temp(n,'0');
    for(int i=st;i<=en;i++)temp[i]='1';
    return ask(temp);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>p>>t;
    int freq=n/(p*n);
    int mx=0;
    while((1<<mx)<freq)mx++;
    mx--;
    mx=min(9,mx);
    mx=max(0,mx);
    while(t--){
        //cerr<<"work"<<endl;
        mp.clear();
        int cur=-1;
        string ans=string(n,'0');
        int og=cur;
        while(cur<n-1){
            int nmx=0;
            int rmx=0;
            if(cur+freq>=n){
                while(cur+(1<<nmx)<n)nmx++;
                nmx--;
                rmx=(1<<nmx);
            }else{
                nmx=mx;
                rmx=freq;
            }
            //cout<<nmx<<endl;
            if(ask(cur+1,cur+rmx)){
                for(int i=nmx;i>=0;i--)if(!ask(cur+1,cur+(1<<i)))cur=cur+(1<<i);
                cur++;
                ans[cur]='1';
            }else{
                cur=cur+rmx;
                continue;
            }
        }
        //cout<<x<<endl;
        //cout<<ask(x)<<endl;
        //assert(ask(x)==0);
        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:43:13: warning: unused variable 'og' [-Wunused-variable]
   43 |         int og=cur;
      |             ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1368 KB Output is correct
2 Correct 5 ms 1532 KB Output is correct
3 Correct 7 ms 1304 KB Output is correct
4 Correct 6 ms 1468 KB Output is correct
5 Correct 7 ms 1368 KB Output is correct
6 Correct 8 ms 1472 KB Output is correct
7 Correct 6 ms 1368 KB Output is correct
8 Correct 7 ms 1488 KB Output is correct
9 Correct 5 ms 1368 KB Output is correct
10 Correct 4 ms 1052 KB Output is correct
11 Correct 5 ms 1432 KB Output is correct
12 Correct 5 ms 1368 KB Output is correct
13 Correct 5 ms 1340 KB Output is correct
14 Correct 5 ms 1288 KB Output is correct
15 Correct 6 ms 1624 KB Output is correct
16 Correct 6 ms 1488 KB Output is correct
17 Runtime error 1 ms 344 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 344 KB Output is correct (P=0.001, F=15.1, Q=12.7) -> 90.00 points
2 Correct 91 ms 776 KB Output is correct (P=0.005256, F=51.1, Q=51.0) -> 90.00 points
3 Correct 180 ms 1108 KB Output is correct (P=0.011546, F=94.9, Q=99.5) -> 75.38 points
4 Correct 395 ms 1012 KB Output is correct (P=0.028545, F=191.5, Q=215.8) -> 59.70 points
5 Correct 458 ms 1020 KB Output is correct (P=0.039856, F=246.3, Q=263.8) -> 70.08 points
6 Correct 685 ms 1528 KB Output is correct (P=0.068648, F=366.2, Q=385.8) -> 74.13 points
7 Correct 1077 ms 1824 KB Output is correct (P=0.104571, F=490.3, Q=586.1) -> 50.52 points
8 Correct 1361 ms 1996 KB Output is correct (P=0.158765, F=639.1, Q=718.1) -> 60.22 points
9 Correct 1758 ms 2248 KB Output is correct (P=0.2, F=731.4, Q=900.4) -> 46.77 points