# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068650 | vjudge1 | COVID tests (CEOI24_covid) | C++17 | 2386 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 <bits/stdc++.h>
using namespace std;
int N;
double P;
bool test_students(vector<bool> mask) {
assert(mask.size() == (size_t)N);
std::string mask_str(N, ' ');
for (int i = 0; i < N; i++)
mask_str[i] = mask[i] ? '1' : '0';
printf("Q %s\n", mask_str.c_str());
fflush(stdout);
char answer;
scanf(" %c", &answer);
return answer == 'P';
}
vector<bool> find_positive() {
vector<bool> answer(N);
vector<bool> idk(N,false);
for(int i=0;i<N;i++){
idk[i]=true;
answer[i]=test_students(idk);
idk[i]=false;
}
return answer;
}
signed main() {
int T;
scanf("%d %lf %d", &N, &P, &T);
for (int i = 0; i < T; i++) {
vector<bool> answer = find_positive();
assert(answer.size() == (size_t)N);
string answer_str(N, ' ');
for (int j = 0; j < N; j++){
answer_str[j] = answer[j] ? '1' : '0';
}
printf("A %s\n", answer_str.c_str());
fflush(stdout);
char verdict;
scanf(" %c", &verdict);
if (verdict == 'W'){
exit(0);
}
}
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... |