# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1204220 | NK_ | COVID tests (CEOI24_covid) | C++20 | 825 ms | 436 KiB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define pb push_back
#define sz(x) int(x.size())
template<class T> using V = vector<T>;
using vi = V<int>;
int N;
double P;
bool qry(vi sample) {
if (sz(sample) == 0) return false;
// assert(mask.size() == (size_t)N);
string mask_str(N, '0');
for(auto& i : sample) mask_str[i] = '1';
printf("Q %s\n", mask_str.c_str());
fflush(stdout);
char answer;
scanf(" %c", &answer);
return answer == 'P';
}
vi get() {
vi ans;
int K = 3;
vi X; for(int i = 0; i < N; i++) X.pb(i);
function<void(vi)> dnc = [&](vi A) {
if (sz(A) == 1) {
ans.pb(A.front());
return;
}
V<vi> S(K);
for(int i = 0; i < sz(A); i++) S[i % K].pb(A[i]);
for(int i = 0; i < K; i++) if (qry(S[i])) dnc(S[i]);
};
dnc(X);
return ans;
}
int main() {
int T;
scanf("%d %lf %d", &N, &P, &T);
// You may perform any extra initialization here.
for (int i = 0; i < T; i++) {
vi answer = get();
// assert(answer.size() == (size_t)N);
string answer_str(N, '0');
for(auto& i : answer) answer_str[i] = '1';
printf("A %s\n", answer_str.c_str());
fflush(stdout);
char verdict;
scanf(" %c", &verdict);
if (verdict == 'W')
exit(0-0);
}
return 0;
}
// Breathe In, Breathe Out
컴파일 시 표준 에러 (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... |