# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026347 | 2024-07-18T01:03:38 Z | 12345678 | COVID tests (CEOI24_covid) | C++17 | 1886 ms | 344 KB |
#include <cassert> #include <cstdio> #include <string> #include <vector> #include <bits/stdc++.h> using namespace std; int N; double P; bool test_students(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(int sz) { vector<bool> qrs(N), res(N); vector<int> vs(N); int a=0, b; while (a<N) { b=min(a+sz-1, N-1); for (int i=0; i<N; i++) qrs[i]=0; for (int i=a; i<=b; i++) qrs[i]=1; if (!test_students(qrs)) { a=b+1; continue; } int l=a, r=b; while (l<r) { int md=(l+r)/2; for (int i=0; i<N; i++) qrs[i]=0; for (int i=l; i<=md; i++) qrs[i]=1; if (test_students(qrs)) r=md; else l=md+1; } res[l]=1; a=l+1; } return res; } std::vector<bool> find_positive_brute_force() { std::vector<bool> answer(N); vector<bool> qrs(N); for (int i=0; i<N; i++) qrs[i]=1, answer[i]=test_students(qrs), qrs[i]=0; return answer; } int main() { int T; scanf("%d %lf %d", &N, &P, &T); for (int i = 0; i < T; i++) { std::vector<bool> answer; if (P==0.001) answer=find_positive(500); else if (P==0.005256) answer=find_positive(125); else if (P==0.011546) answer=find_positive(59); else if (P==0.028545) answer=find_positive(25); else if (P==0.039856) answer=find_positive(17); else if (P==0.068648) answer=find_positive(10); else if (P==0.104571) answer=find_positive(7); else if (P==0.158765) answer=find_positive(4); else if (P==0.2) answer=find_positive(4); else answer=find_positive_brute_force(); 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; } //PNPPN //0110011
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 344 KB | Output is correct |
3 | Correct | 10 ms | 344 KB | Output is correct |
4 | Correct | 8 ms | 344 KB | Output is correct |
5 | Correct | 6 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 7 ms | 344 KB | Output is correct |
8 | Correct | 9 ms | 344 KB | Output is correct |
9 | Correct | 6 ms | 344 KB | Output is correct |
10 | Correct | 7 ms | 344 KB | Output is correct |
11 | Correct | 8 ms | 344 KB | Output is correct |
12 | Correct | 6 ms | 344 KB | Output is correct |
13 | Correct | 6 ms | 344 KB | Output is correct |
14 | Correct | 8 ms | 344 KB | Output is correct |
15 | Correct | 8 ms | 344 KB | Output is correct |
16 | Correct | 5 ms | 344 KB | Output is correct |
17 | Correct | 6 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 344 KB | Output is correct (P=0.001, F=15.1, Q=10.9) -> 90.00 points |
2 | Correct | 127 ms | 344 KB | Output is correct (P=0.005256, F=51.1, Q=46.6) -> 90.00 points |
3 | Correct | 243 ms | 344 KB | Output is correct (P=0.011546, F=94.9, Q=91.1) -> 90.00 points |
4 | Correct | 521 ms | 344 KB | Output is correct (P=0.028545, F=191.5, Q=190.4) -> 90.00 points |
5 | Correct | 672 ms | 344 KB | Output is correct (P=0.039856, F=246.3, Q=246.8) -> 89.28 points |
6 | Correct | 958 ms | 344 KB | Output is correct (P=0.068648, F=366.2, Q=373.1) -> 83.69 points |
7 | Correct | 1293 ms | 344 KB | Output is correct (P=0.104571, F=490.3, Q=499.1) -> 83.97 points |
8 | Correct | 1612 ms | 344 KB | Output is correct (P=0.158765, F=639.1, Q=633.1) -> 90.00 points |
9 | Correct | 1886 ms | 344 KB | Output is correct (P=0.2, F=731.4, Q=740.9) -> 85.55 points |