QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500151 | #9162. COVID tests | bachbeo2007 | 87.86 | 173ms | 3964kb | C++23 | 1.1kb | 2024-07-31 23:22:56 | 2024-07-31 23:23:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int N,T;
double P;
int query(int l,int r){
string s(N,'0');
for(int i=l;i<r;i++) s[i]++;
cout << "Q " << s << endl;
char C;cin >> C;
return (C=='P');
}
void answer(vector<int> &ans){
string s(N,'0');
for(int i=0;i<N;i++) if(ans[i]) s[i]++;
cout << "A " << s << endl;
char C;cin >> C;
if(C=='W') exit(0);
}
void solve(){
vector<int> ans(N);
if(T==1){
for(int i=0;i<N;i++) ans[i]=query(i,i+1);
answer(ans);
return;
}
int D=(int)(0.75/P);
if(0.05<P && P<0.08) D=(int)(0.6/P);
for(int i=0;i<N;){
int x=min(N,i+D);
if(!query(i,x)) i=x;
else{
int l=i,r=x;
while(l+1<r){
int m=(l+r)>>1;
(query(i,m)?r:l)=m;
}
ans[l]=1,i=l+1;
}
}
answer(ans);
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
cin >> N >> P >> T;
while(T--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
1000 0.789673 1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ...
output:
Q 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
Subtask #2:
score: 87.86
Acceptable Answer
Test #18:
score: 90
Accepted
time: 0ms
memory: 3752kb
input:
1000 0.001 300 N N C P N N N P N N P P N P N C N P P N P N P N P N P P P N N N P N N P P P N N N P N N C N N C N N C P P N N N P N P P P N C N P P P P N N N N N N C N N C N N C P P N P N N P P N P N C N N C N P P N P N P P N N P P N N P P N N N N C P N N P N N N P N N N P P P N N P P N N P P N P P P...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
points 1.0 1.0 Output is correct (P=0.001, F=15.1, Q=14.3) -> 90.00 points
Test #19:
score: 90
Accepted
time: 13ms
memory: 3952kb
input:
1000 0.005256 300 P N P N P N P N P P P P N P P N N N P P N N P P N P N N P P N N P P P P N P P N N P N N N N C N N N N P P N P P P N P N P N N P P P P P P P N N P P P P N C N N N N N N P P N N N N N P N C N P P P P N P N N N P P P P P N P P P P P P P N P N N N N P P P N N N P P N P N P P N N N N N ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 Output is correct (P=0.005256, F=51.1, Q=49.9) -> 90.00 points
Test #20:
score: 90
Accepted
time: 41ms
memory: 3788kb
input:
1000 0.011546 300 P P N P P P P P P P N P P P N N N P P N P N P N P N N N N N N P P P P P P N P P P P P P N P P N N P N N P P P P N N N N N N N N N N P P N P P P N P N P N P N N N P P N P P N N P P N N N N N N C N P N P P P P N N N N N P P P P N N P N N N N N N N P P P P P P N N P N N N N N N N C P ...
output:
Q 1111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 Output is correct (P=0.011546, F=94.9, Q=93.9) -> 90.00 points
Test #21:
score: 89.63
Acceptable Answer
time: 55ms
memory: 3880kb
input:
1000 0.028545 300 P P P P P N N N P P P P P N N P P P N P P P P N P N N P N P N N N P P P N P P N N N N N N N N P N P N N P P N N P N P P N P P N P P P N N N N P N N P N N P P P P P P P N P P P P P N N P N P N N P P N N P N P P N N N P N N P P P P N N N N P N N P P N N P N P N P N N P P N P N N N P ...
output:
Q 1111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.99588888890 0.9958888889 Output is correct (P=0.028545, F=191.5, Q=191.7) -> 89.63 points
Test #22:
score: 87.86
Acceptable Answer
time: 42ms
memory: 3788kb
input:
1000 0.039856 300 P N P P P N P P P P N P P P N N N N N N N N P N N N P N P P N N N P P P P P N P P N P N P P N N P P P N N N P P P P N N N N P P P N N P N N N P P N N N N P P N N N N P N P P N P P N N N N N N P P N P P N P N P P P N P N N N P N P P N N N P N P N P N N P N N N N N P P P P P P P P N ...
output:
Q 1111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.97622222220 0.9762222222 Output is correct (P=0.039856, F=246.3, Q=247.8) -> 87.86 points
Test #23:
score: 88.36
Acceptable Answer
time: 69ms
memory: 3752kb
input:
1000 0.068648 300 N P N N P P P N N P P N N P P P P N P P N N P P P P P P P N N P P P P P N P P N N P N N P N P P P P N P P P P N N N P P P N N N P N P N N N N N N N N N P N P N N P P P P P P P P P P P P N P N P N N N P P N N N P P N N N N N P P N P N P P P P N N N P N N N P N P N P N P N N N N P P ...
output:
Q 1111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.98177777780 0.9817777778 Output is correct (P=0.068648, F=366.2, Q=367.9) -> 88.36 points
Test #24:
score: 89.63
Acceptable Answer
time: 120ms
memory: 3712kb
input:
1000 0.104571 300 N N N P P P N P N N P P P N P P P P N N P N N N P P N N P N N P P P N N P N N N P P N N P P P P N N N P P N P N N N N P N N P N N P P N P N N P P N N N N N N P P P P P N P P N P P P P N N P N P P N P N P P N P N P P N N P P N N P P N N P P P P N P N P N N P P N P P N P P N P N P P ...
output:
Q 1111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 0.99588888890 0.9958888889 Output is correct (P=0.104571, F=490.3, Q=490.8) -> 89.63 points
Test #25:
score: 90
Accepted
time: 139ms
memory: 3756kb
input:
1000 0.158765 300 N N N N P P P N P P N N N P P N P P P N N N N N N N N P N N P P N N N N N P P N N N N P P N N N N P N N N P N N N N P N P N N N P N P P N P N P P P N P N P N N N N N N P P P P P P P P P N N P P N N N N N N P N N N N P P N P N P P P P P P N P N N N P N P P N N P N P N P P N P N P N ...
output:
Q 1111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 Output is correct (P=0.158765, F=639.1, Q=634.4) -> 90.00 points
Test #26:
score: 90
Accepted
time: 173ms
memory: 3964kb
input:
1000 0.2 300 N P N P N P N P P N P N N N N N P N N P N P P P N P N P P N P P N N P N P N P P P N P N P P P P N P N N P N N N N N N P N N P P P P N P N N N P N N N P P N P P N N N N P N P P N P P P P N N N N P P P P P N P P N N N P N N P N P P N P N N N N P N P P P P P P N N N N P N P N N N P N P N N...
output:
Q 1110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 1.0 Output is correct (P=0.2, F=731.4, Q=730.3) -> 90.00 points