#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;
int DIV=100;
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, int to){
if(!queryRange(from, to)){
return to+1;
}
int l=from;
int r=to;
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';
}
for(int fromm=0;fromm<n;fromm+=n/DIV){
int from=fromm;
int to=from+n/DIV-1;
while(true){
int ind=findNextPositive(from,to);
if(ind==to+1){
break;
}
from=ind+1;
ans[ind]='1';
if(from>=to+1)break;
}
}
cout<<"A "<<ans<<endl;
char c;
cin>>c;
if(c=='W'){
return 0;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7068 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
3524 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
246 ms |
600 KB |
Output is correct (P=0.001, F=15.1, Q=103.9) -> 3.67 points |
2 |
Correct |
287 ms |
832 KB |
Output is correct (P=0.005256, F=51.1, Q=121.8) -> 13.77 points |
3 |
Correct |
377 ms |
1308 KB |
Output is correct (P=0.011546, F=94.9, Q=148.8) -> 27.51 points |
4 |
Correct |
544 ms |
1028 KB |
Output is correct (P=0.028545, F=191.5, Q=220.1) -> 56.34 points |
5 |
Correct |
690 ms |
1468 KB |
Output is correct (P=0.039856, F=246.3, Q=268.0) -> 66.55 points |
6 |
Correct |
1048 ms |
1552 KB |
Output is correct (P=0.068648, F=366.2, Q=384.0) -> 75.35 points |
7 |
Correct |
1146 ms |
2204 KB |
Output is correct (P=0.104571, F=490.3, Q=523.8) -> 70.68 points |
8 |
Correct |
1907 ms |
2280 KB |
Output is correct (P=0.158765, F=639.1, Q=719.6) -> 59.85 points |
9 |
Correct |
2258 ms |
2288 KB |
Output is correct (P=0.2, F=731.4, Q=876.7) -> 50.15 points |