#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 4, BS = 30;
int n;
double p;
bool students[N];
bool query(int l, int r) {
cout << "Q ";
for (int i = 1; i <= n; i++) {
if (i >= l && i <= r) cout << "1";
else cout << "0";
}
cout << "\n";
cout.flush();
char ans; cin >> ans;
return ans == 'P';
}
void test(int l, int r) {
if (query(l, r)) {
if (l == r) {
students[l] = 1;
} else {
int m = (l + r) >> 1;
test(l, m);
test(m + 1, r);
}
}
}
void prepare() {
for (int i = 0; i <= n; i++) {
students[i] = false;
}
}
char solve() {
prepare();
for (int i = 1; i <= n; i += BS) {
if (query(i, i + BS - 1)) {
test(i, i + BS - 1);
}
}
cout << "A ";
for (int i = 1; i <= n; i++) {
cout << (students[i] ? '1' : '0');
}
cout << "\n";
cout.flush();
char ans; cin >> ans;
return ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t; cin >> n >> p >> t;
while (t--) {
char verdict = solve();
if (verdict == 'W') {
return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
344 KB |
Output is correct |
2 |
Correct |
54 ms |
344 KB |
Output is correct |
3 |
Correct |
49 ms |
344 KB |
Output is correct |
4 |
Correct |
38 ms |
344 KB |
Output is correct |
5 |
Incorrect |
40 ms |
344 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
287 ms |
344 KB |
Output is correct (P=0.001, F=15.1, Q=43.9) -> 10.43 points |
2 |
Correct |
585 ms |
344 KB |
Output is correct (P=0.005256, F=51.1, Q=87.7) -> 23.29 points |
3 |
Correct |
1079 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=149.6) -> 27.23 points |
4 |
Correct |
2109 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=298.9) -> 27.75 points |
5 |
Correct |
2638 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=384.6) -> 27.73 points |
6 |
Correct |
3955 ms |
344 KB |
Output is correct (P=0.068648, F=366.2, Q=570.8) -> 27.82 points |
7 |
Correct |
5304 ms |
344 KB |
Output is correct (P=0.104571, F=490.3, Q=756.2) -> 28.40 points |
8 |
Execution timed out |
7048 ms |
344 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |