답안 #1036495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036495 2024-07-27T13:01:50 Z Warinchai COVID tests (CEOI24_covid) C++14
0 / 100
1 ms 600 KB
#include<bits/stdc++.h>
using namespace std;
int n,t;
double p;
int use=0;
int ask(vector<int>v){
    //use++;
    cout<<"Q ";
    for(auto x:v)cout<<x;
    cout<<endl;
    //cerr<<"input:"<<endl;
    char ans;
    cin>>ans;
    //cerr<<ans<<endl;
    return ans=='P'?1:0;
}
vector<int>temp;
void fans(int st,int en,vector<int>&ans){
    //cerr<<st<<" "<<en<<endl;
    if(st>=en)return;
    int m=(st+en)/2;
    for(int i=st;i<=m;i++)temp[i]=1;
    vector<int>l,r;
    if(ask(temp)){
        if(st==m)ans[st]=1;
        else fans(st,m,ans);
    }
    for(int i=st;i<=m;i++)temp[i]=0;
    for(int i=m+1;i<=en;i++)temp[i]=1;
    if(ask(temp)){
        if(m+1==en)ans[en]=1;
        else fans(st,m,ans);
    }
    for(int i=m+1;i<=en;i++)temp[i]=0;
}
vector<int>ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>p>>t;
    temp.resize(n);
    while(t--){
        //cerr<<"work"<<endl;
        ans.clear();
        use=0;
        fans(0,n-1,ans);
        cout<<"A ";
        for(auto x:ans)cout<<x;
        cout<<endl;
        char res;
        cin>>res;
        //cerr<<"use:"<<use<<endl;
        if(res=='W')break;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -