This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=5007;
ll n,m,k;
double p;
map<string, int>d;
bool query(string s){
if(d[s]){
if(d[s]==1){
return false;
}
return true;
}
cout<<"Q "<<s<<endl;
char res;
cin>>res;
bool ress=false;
if(res=='P'){
ress=true;
}
d[s]=ress+1;
return ress;
}
void clear(){
d.clear();
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("Binput.txt","r",stdin);
// freopen("Boutput.txt","w",stdout);
cin>>n>>p>>ttt;
while(ttt--){
clear();
string ans="";
for(int i=0;i<n;i++){
string s="";
for(int j=0;j<i;j++){
s+='0';
}
s+='1';
for(int j=i+1;j<n;j++){
s+='0';
}
bool res=query(s);
if(res){
ans+='1';
}
else{
ans+='0';
}
}
cout<<"A "<<ans<<endl;
char c;
cin>>c;
if(c=='W'){
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |