#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;
}
bool queryRange(int l, int r){
string s="";
for(int i=0;i<l;i++){
s+='0';
}
for(int i=l;i<=r;i++){
s+='1';
}
for(int i=r+1;i<n;i++){
s+='0';
}
return query(s);
}
int findNextPositive(int from){
if(!queryRange(from, n-1)){
return n;
}
int l=from;
int r=n-1;
while(l<r){
int mid=(l+r)/2;
if(queryRange(l, mid)){
r=mid;
}
else{
l=mid+1;
}
}
return l;
}
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++){
ans+='0';
}
int from=0;
while(true){
int ind=findNextPositive(from);
if(ind==n){
break;
}
from=ind+1;
ans[ind]='1';
if(from>=n)break;
}
cout<<"A "<<ans<<endl;
char c;
cin>>c;
if(c=='W'){
return 0;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
72 ms |
9108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
632 KB |
Output is correct (P=0.001, F=15.1, Q=10.7) -> 90.00 points |
2 |
Correct |
126 ms |
776 KB |
Output is correct (P=0.005256, F=51.1, Q=52.9) -> 78.89 points |
3 |
Correct |
291 ms |
1096 KB |
Output is correct (P=0.011546, F=94.9, Q=114.6) -> 49.17 points |
4 |
Correct |
796 ms |
1992 KB |
Output is correct (P=0.028545, F=191.5, Q=279.4) -> 31.73 points |
5 |
Correct |
912 ms |
2216 KB |
Output is correct (P=0.039856, F=246.3, Q=392.4) -> 26.68 points |
6 |
Correct |
1966 ms |
2264 KB |
Output is correct (P=0.068648, F=366.2, Q=673.2) -> 20.67 points |
7 |
Correct |
2529 ms |
3092 KB |
Output is correct (P=0.104571, F=490.3, Q=1023.8) -> 16.81 points |
8 |
Correct |
4091 ms |
3040 KB |
Output is correct (P=0.158765, F=639.1, Q=1540.6) -> 13.55 points |
9 |
Execution timed out |
4544 ms |
3980 KB |
Time limit exceeded (wall clock) |
10 |
Halted |
0 ms |
0 KB |
- |