#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, t, mid;
double p;
string res, ask;
char temp;
void bs(int l, int r) {
if(l == r) res[l] = '1';
else {
mid = (l + r) / 2;
for(int i = 0; i < n; i++) {
if(l <= i && i <= mid) ask[i] = '1';
else ask[i] = '0';
}
cout << "Q " << ask << endl;
cin >> temp;
if(temp == 'P') bs(l, mid);
//
for(int i = 0; i < n; i++) {
if(mid + 1 <= i && i <= r) ask[i] = '1';
else ask[i] = '0';
}
cout << "Q " << ask << endl;
cin >> temp;
if(temp == 'P') bs(mid + 1, r);
}
}
void solve() {
res = string(n, '0');
ask = string(n, '1');
cout << "Q " << ask << endl;
cin >> temp;
if(temp == 'P') bs(0, n - 1);
cout << "A " << res << endl;
cin >> temp;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> p >> t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
344 KB |
Output is correct (P=0.001, F=15.1, Q=20.7) -> 36.24 points |
2 |
Correct |
209 ms |
344 KB |
Output is correct (P=0.005256, F=51.1, Q=96.6) -> 19.73 points |
3 |
Correct |
471 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=192.7) -> 17.57 points |
4 |
Correct |
977 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=412.1) -> 16.05 points |
5 |
Correct |
1198 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=537.8) -> 15.70 points |
6 |
Correct |
2011 ms |
344 KB |
Output is correct (P=0.068648, F=366.2, Q=823.1) -> 15.02 points |
7 |
Correct |
2732 ms |
344 KB |
Output is correct (P=0.104571, F=490.3, Q=1124.7) -> 14.57 points |
8 |
Correct |
3797 ms |
344 KB |
Output is correct (P=0.158765, F=639.1, Q=1510.9) -> 13.94 points |
9 |
Execution timed out |
4014 ms |
344 KB |
Time limit exceeded (wall clock) |
10 |
Halted |
0 ms |
0 KB |
- |