# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1036023 | sleepntsheep | COVID tests (CEOI24_covid) | C11 | 3148 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <string.h>
int n, t;
double p;
int main() {
scanf("%d%lf%d", &n, &p, &t);
if (t == 1) {
char a[1001] = { 0 };
for (int i = 0; i < n; ++i)
a[i] = '0';
for (int i = 0; i < n; ++i) {
char q[1001] = { 0 };
for (int j = 0; j < n; ++j)
q[j] = '0' + (j == i);
printf("Q %s\n", q);
fflush(stdout);
char result;
scanf(" %c", &result);
if (result == 'P') a[i] = '1';
}
printf("A %s\n", a);
fflush(stdout);
return 0;
}
while (t--) {
char a[1001] = { 0 };
for (int i = 0; i < n; ++i)
a[i] = '0';
int at = 0;
while (at < n) {
int lb = at - 1, ub = n;
while (ub - lb > 1) {
int md = lb + (ub - lb) / 2;
char q[1001] = { 0 };
for (int i = 0; i < n; ++i)
q[i] = '0';
for (int j = at; j <= md; ++j)
q[j] = '1';
printf("Q %s\n", q);
fflush(stdout);
char result;
scanf(" %c", &result);
if (result == 'P') ub = md;
else lb = md;
}
if (ub < n)
a[ub] = '1';
at = ub + 1;
}
printf("A %s\n", a);
fflush(stdout);
char verdict;
scanf(" %c", &verdict);
if ('W' == verdict)
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |