# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1036027 | sleepntsheep | COVID tests (CEOI24_covid) | C11 | 3437 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
int n, t;
double p;
char ask(char *q) {
char result;
printf("Q %s\n", q);
fflush(stdout);
scanf(" %c", &result);
return result;
}
int main() {
scanf("%d%lf%d", &n, &p, &t);
if (t == 1) {
char a[1001] = { 0 };
for (int i = 0; i < n; ++i) {
char q[1001] = { 0 };
for (int j = 0; j < n; ++j)
q[j] = '0' + (j == i);
a[i] = (ask(q) == 'P') + '0';
}
printf("A %s\n", a);
return 0;
}
int x = n / p;
while (t--) {
char a[1001] = { 0 };
for (int i = 0; i < n; ++i)
a[i] = '0';
int at = 0;
while (at < n) {
char q[1001] = { 0 };
for (int i = 0; i < n; ++i)
q[i] = '0';
for (int i = at; i < at + x && i < n; ++i)
q[i] = '1';
if (ask(q) == 'N') {
at += x;
continue;
}
int lb = at - 1, ub = n;
while (ub - lb > 1) {
int md = lb + (ub - lb) / 2;
for (int i = 0; i < n; ++i)
q[i] = '0';
for (int i = at; i <= md; ++i)
q[i] = '1';
if (ask(q) == '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;
}
}
컴파일 시 표준 에러 (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... |