#include <stdio.h>
#include <string.h>
#define N 1000
int n;
int query(int l, int r) {
static char cc[N + 1], s[2];
memset(cc, '0', n * sizeof *cc), memset(cc + l, '1', (r - l) * sizeof *cc), cc[n] = 0;
printf("Q %s\n", cc), fflush(stdout);
scanf("%s", s);
return s[0] == 'P';
}
char cc[N + 1];
int solve(int l, int r, int has) {
int m;
if (!has && !query(l, r)) {
memset(cc + l, '0', (r - l) * sizeof *cc);
return 0;
}
if (r - l > 1) {
m = (l + r) / 2;
solve(m, r, !solve(l, m, 0));
}
return 1;
}
int main() {
int t;
scanf("%d%*f%d", &n, &t);
while (t--) {
memset(cc, '1', n * sizeof *cc), cc[n] = 0;
solve(0, n, 0);
printf("A %s\n", cc), fflush(stdout);
scanf("%*s");
}
return 0;
}
Compilation message
Main.c: In function 'query':
Main.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
13 | scanf("%s", s);
| ^~~~~~~~~~~~~~
Main.c: In function 'main':
Main.c:36:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | scanf("%d%*f%d", &n, &t);
| ^~~~~~~~~~~~~~~~~~~~~~~~
Main.c:41:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
41 | scanf("%*s");
| ^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
356 KB |
Output is correct |
4 |
Correct |
7 ms |
344 KB |
Output is correct |
5 |
Correct |
8 ms |
344 KB |
Output is correct |
6 |
Correct |
7 ms |
344 KB |
Output is correct |
7 |
Correct |
8 ms |
344 KB |
Output is correct |
8 |
Correct |
6 ms |
344 KB |
Output is correct |
9 |
Correct |
6 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
5 ms |
344 KB |
Output is correct |
12 |
Correct |
5 ms |
344 KB |
Output is correct |
13 |
Correct |
6 ms |
344 KB |
Output is correct |
14 |
Correct |
5 ms |
344 KB |
Output is correct |
15 |
Correct |
4 ms |
344 KB |
Output is correct |
16 |
Correct |
7 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
344 KB |
Output is correct (P=0.001, F=15.1, Q=13.8) -> 90.00 points |
2 |
Correct |
88 ms |
344 KB |
Output is correct (P=0.005256, F=51.1, Q=60.7) -> 51.39 points |
3 |
Correct |
182 ms |
344 KB |
Output is correct (P=0.011546, F=94.9, Q=117.9) -> 45.70 points |
4 |
Correct |
396 ms |
344 KB |
Output is correct (P=0.028545, F=191.5, Q=240.7) -> 44.39 points |
5 |
Correct |
490 ms |
344 KB |
Output is correct (P=0.039856, F=246.3, Q=309.4) -> 44.45 points |
6 |
Correct |
717 ms |
344 KB |
Output is correct (P=0.068648, F=366.2, Q=458.3) -> 44.87 points |
7 |
Correct |
968 ms |
344 KB |
Output is correct (P=0.104571, F=490.3, Q=612.9) -> 45.00 points |
8 |
Correct |
1244 ms |
344 KB |
Output is correct (P=0.158765, F=639.1, Q=801.1) -> 44.69 points |
9 |
Correct |
1384 ms |
344 KB |
Output is correct (P=0.2, F=731.4, Q=930.9) -> 43.04 points |