#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 |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1368 KB |
Output is correct |
2 |
Correct |
7 ms |
1368 KB |
Output is correct |
3 |
Correct |
8 ms |
1348 KB |
Output is correct |
4 |
Correct |
8 ms |
1396 KB |
Output is correct |
5 |
Correct |
9 ms |
1368 KB |
Output is correct |
6 |
Correct |
10 ms |
1404 KB |
Output is correct |
7 |
Correct |
7 ms |
1364 KB |
Output is correct |
8 |
Correct |
9 ms |
1620 KB |
Output is correct |
9 |
Correct |
7 ms |
1368 KB |
Output is correct |
10 |
Correct |
8 ms |
1428 KB |
Output is correct |
11 |
Correct |
9 ms |
1368 KB |
Output is correct |
12 |
Correct |
9 ms |
1332 KB |
Output is correct |
13 |
Correct |
7 ms |
1368 KB |
Output is correct |
14 |
Correct |
9 ms |
1632 KB |
Output is correct |
15 |
Correct |
8 ms |
1368 KB |
Output is correct |
16 |
Correct |
11 ms |
1504 KB |
Output is correct |
17 |
Correct |
9 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2109 ms |
2832 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |