#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
const char nl = '\n';
void fastIO() {
ios::sync_with_stdio(false);
cin.tie(0);
}
int N, T;
double P;
char query(vi v) {
string s(N, '0');
for (int x : v)
s[x] = '1';
cout<<"Q "<<s<<endl;
cout.flush();
char c;
cin>>c;
return c;
}
char query(int l, int r) {
string s(N, '0');
for (int i = l; i <= r; i++) {
s[i] = '1';
}
cout<<"Q "<<s<<endl;
cout.flush();
char c;
cin>>c;
return c;
}
int main() {
fastIO();
cin>>N>>P>>T;
// int len = min((int)(1.0 / P) + 1, N);
int len = 50;
for (int i = 0; i < T; i++) {
string ans(N, '0');
for (int j = 0; j < N; j += len) {
int lp = j;
int rp = min(j + len - 1, N - 1);
if (query(lp, rp) == 'N')
continue;
if (lp == rp) {
ans[lp] = '1';
continue;
}
for (int k = lp; k <= rp; k++) {
vi v;
v.pb(k);
char c = query(v);
if (c == 'P')
ans[k] = '1';
}
}
// cout<<"ANSWER: ";
cout<<"A "<<ans<<endl;
cout.flush();
char c;
cin>>c;
if (c == 'W')
break;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
5 ms |
344 KB |
Output is correct |
8 |
Correct |
5 ms |
344 KB |
Output is correct |
9 |
Correct |
6 ms |
344 KB |
Output is correct |
10 |
Correct |
5 ms |
344 KB |
Output is correct |
11 |
Correct |
4 ms |
344 KB |
Output is correct |
12 |
Correct |
5 ms |
344 KB |
Output is correct |
13 |
Correct |
4 ms |
344 KB |
Output is correct |
14 |
Correct |
6 ms |
344 KB |
Output is correct |
15 |
Correct |
6 ms |
344 KB |
Output is correct |
16 |
Correct |
5 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
348 KB |
Output is correct (P=0.001, F=15.1, Q=65.0) -> 6.33 points |
2 |
Correct |
460 ms |
352 KB |
Output is correct (P=0.005256, F=51.1, Q=245.5) -> 5.55 points |
3 |
Correct |
836 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=454.8) -> 5.57 points |
4 |
Correct |
1446 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=786.5) -> 6.70 points |
5 |
Correct |
1687 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=889.1) -> 7.87 points |
6 |
Correct |
1951 ms |
596 KB |
Output is correct (P=0.068648, F=366.2, Q=992.8) -> 11.47 points |
7 |
Correct |
2058 ms |
344 KB |
Output is correct (P=0.104571, F=490.3, Q=1016.1) -> 17.01 points |
8 |
Correct |
2009 ms |
344 KB |
Output is correct (P=0.158765, F=639.1, Q=1020.0) -> 26.60 points |
9 |
Correct |
2114 ms |
344 KB |
Output is correct (P=0.2, F=731.4, Q=1020.0) -> 34.91 points |