Submission #1237471

#TimeUsernameProblemLanguageResultExecution timeMemory
1237471GrayCOVID tests (CEOI24_covid)C++20
10 / 100
7037 ms436 KiB
#include<bits/stdc++.h>
#define ld long double
#define ll long long
#define ff first
#define ss second
#define ln "\n"

using namespace std;
const ll INF = 2e9;

ll n, t; ld p;
string __res;

bool test(vector<bool> &give){
    #ifndef LOCAL
    cout << "Q ";
    for (ll i=0; i<n; i++) cout << give[i];
    cout << endl;
    char x; cin >> x; return (x=='P');
    #else
    bool res=0;
    for (ll i=0; i<n; i++){
        if (give[i] and __res[i]-'0') res=1;
    }
    return res;
    #endif
}

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

bool ask(ll l, ll r){
    vector<bool> qry(n);
    for (ll i=l; i<=r; i++) qry[i]=1;
    return test(qry);
}

void get(ll l, ll r, vector<bool> &res){
    if (l==r){
        res[l]=1; return;
    }
    ll m = (l+r)/2;
    if (ask(l, m)) get(l, m, res);
    if (m+1<=r and ask(m+1, r)) get(m+1, r, res);
}

vector<bool> solvep(){
    vector<bool> res(n);
    get(0, n-1, res);
    return res;
}

void solve(){
    #ifdef LOCAL
    cin >> __res;
    #endif
    vector<bool> res = solvep();
    cout << "A ";
    for (ll i=0; i<n; i++) cout << res[i];
    cout << endl; char _; cin >> _;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> p >> t;
    while (t--){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...