답안 #1038020

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038020 2024-07-29T12:09:28 Z Warinchai COVID tests (CEOI24_covid) C++14
0 / 100
7000 ms 356 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(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;
vector<int>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.resize(n);
    ans.resize(n);
    while(t--){
        //cerr<<"work"<<endl;
        for(auto &x:ans)x=0;
        use=0;
        int prob=p*n;
        int div=n/prob;
        //cout<<"prob:"<<prob<<endl;
        for(int i=1;i<=prob;i++){
            vector<int>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);
        }
        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 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 344 KB translate:wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 356 KB Output is correct (P=0.001, F=15.1, Q=17.8) -> 52.47 points
2 Correct 818 ms 344 KB Output is correct (P=0.005256, F=51.1, Q=75.5) -> 30.93 points
3 Correct 1464 ms 344 KB Output is correct (P=0.011546, F=94.9, Q=142.8) -> 29.81 points
4 Correct 2786 ms 344 KB Output is correct (P=0.028545, F=191.5, Q=282.0) -> 31.14 points
5 Correct 3779 ms 344 KB Output is correct (P=0.039856, F=246.3, Q=361.1) -> 31.42 points
6 Correct 5339 ms 344 KB Output is correct (P=0.068648, F=366.2, Q=517.5) -> 33.93 points
7 Execution timed out 7004 ms 344 KB Time limit exceeded
8 Halted 0 ms 0 KB -