답안 #1042117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1042117 2024-08-02T14:52:41 Z Warinchai COVID tests (CEOI24_covid) C++14
60.24 / 100
1620 ms 2120 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);
    if(p==0)freq=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=mx;
            int rmx=freq;
            //cout<<nmx<<endl;
            if(ask(og+1,cur+freq)){
                for(int i=nmx;i>=0;i--)if(!ask(og+1,cur+(1<<i)))cur=cur+(1<<i);
                cur++;
                ans[cur]='1';
                og=cur;
            }else{
                cur=cur+freq;
                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:47:17: warning: unused variable 'rmx' [-Wunused-variable]
   47 |             int rmx=freq;
      |                 ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1368 KB Output is correct
2 Correct 6 ms 1372 KB Output is correct
3 Correct 6 ms 1436 KB Output is correct
4 Correct 5 ms 1368 KB Output is correct
5 Correct 10 ms 1424 KB Output is correct
6 Correct 5 ms 1428 KB Output is correct
7 Correct 6 ms 1624 KB Output is correct
8 Correct 7 ms 1612 KB Output is correct
9 Correct 8 ms 1368 KB Output is correct
10 Correct 4 ms 1112 KB Output is correct
11 Correct 8 ms 1368 KB Output is correct
12 Correct 6 ms 1368 KB Output is correct
13 Correct 7 ms 1368 KB Output is correct
14 Correct 6 ms 1372 KB Output is correct
15 Correct 6 ms 1624 KB Output is correct
16 Correct 7 ms 1432 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 344 KB Output is correct (P=0.001, F=15.1, Q=10.8) -> 90.00 points
2 Correct 86 ms 540 KB Output is correct (P=0.005256, F=51.1, Q=49.0) -> 90.00 points
3 Correct 179 ms 624 KB Output is correct (P=0.011546, F=94.9, Q=98.0) -> 79.60 points
4 Correct 428 ms 972 KB Output is correct (P=0.028545, F=191.5, Q=214.6) -> 60.71 points
5 Correct 477 ms 1260 KB Output is correct (P=0.039856, F=246.3, Q=262.4) -> 71.35 points
6 Correct 743 ms 1368 KB Output is correct (P=0.068648, F=366.2, Q=379.4) -> 78.66 points
7 Correct 1093 ms 1620 KB Output is correct (P=0.104571, F=490.3, Q=579.0) -> 52.22 points
8 Correct 1356 ms 1732 KB Output is correct (P=0.158765, F=639.1, Q=682.5) -> 70.78 points
9 Correct 1620 ms 2120 KB Output is correct (P=0.2, F=731.4, Q=876.1) -> 50.24 points