# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1134615 | Nurislam | COVID tests (CEOI24_covid) | C++20 | 1020 ms | 408 KiB |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define pb push_back
int n;
double P;
bool tst(std::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';
}
std::vector<bool> find_positive() {
vector<bool> ans(n, 0);
auto f = [&](int l, int r) -> void{
vector<bool> m(n, 0);
for(int i = l; i < r; i++){
m[i] = 1;
if(tst(m))ans[i]=1;
m[i]= 0;
}
return;
};
int bl = 50;
vector<bool> mark(n, 0);
for(int i = 0; i < n; i += bl){
int l = i, r = min(l+bl, n);
for(int x = l; x < r; x++)mark[x] = 1;
if(tst(mark))f(l, r);
for(int x = l; x < r; x++)mark[x] = 0;
}
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++) {
std::vector<bool> answer = find_positive();
assert(answer.size() == (size_t)n);
std::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;
}
컴파일 시 표준 에러 (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... |