# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1044715 | 2024-08-05T12:44:57 Z | Tsovak | COVID tests (CEOI24_covid) | C++17 | 2222 ms | 596 KB |
// -------------------- Includes -------------------- // #define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <cstdio> #include <stdio.h> #include <cstdlib> #include <stdlib.h> #include <array> #include <string> #include <cstring> #include <algorithm> #include <cmath> #include <math.h> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <vector> #include <stack> #include <queue> #include <deque> #include <bitset> #include <list> #include <iterator> #include <numeric> #include <complex> #include <tuple> #include <utility> #include <cassert> #include <assert.h> #include <climits> #include <limits.h> #include <ctime> #include <time.h> #include <random> #include <chrono> #include <fstream> using namespace std; // -------------------- Typedefs -------------------- // typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; // -------------------- Defines -------------------- // #define pr pair #define mpr make_pair #define ff first #define ss second #define mset multiset #define mmap multimap #define uset unordered_set #define umap unordered_map #define umset unordered_multiset #define ummap unordered_multimap #define pqueue priority_queue #define sz(x) (int((x).size())) #define len(x) (int((x).length())) #define all(x) (x).begin(), (x).end() #define clr(x) (x).clear() #define ft front #define bk back #define pf push_front #define pb push_back #define popf pop_front #define popb pop_back #define lb lower_bound #define ub upper_bound #define bs binary_search // -------------------- Constants -------------------- // const int MAX = int(1e9 + 5); const ll MAXL = ll(1e18 + 5); const ll MOD = ll(1e9 + 7); const ll MOD2 = ll(998244353); // -------------------- Solution -------------------- // int N; double P; inline bool test_students(vector<bool> mask) { assert(mask.size() == (size_t)N); 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> ans; bool qry(int l, int r) { vector<bool> msk(N, 0); for (int i = l; i <= r; i++) msk[i - 1] = 1; return test_students(msk); } void calc(int tl, int tr) { if (tl == tr) { if (qry(tl, tl)) ans[tl - 1] = 1; else ans[tl - 1] = 0; return; } int m = (tl + tr) / 2; if (qry(tl, m)) { if (tl == m) ans[tl - 1] = 1; else calc(tl, m); } else for (int i = tl; i <= m; i++) ans[i - 1] = 0; if (qry(m + 1, tr)) { if (m + 1 == tr) ans[m] = 1; else calc(m + 1, tr); } else for (int i = m + 1; i <= tr; i++) ans[i - 1] = 0; return; } vector<bool> find_positive() { int i, j; int h = int(db(N) * P); //calc(1, N); int len = min(N, N / h); len = 251; assert(1 <= h && h <= N); for (i = 1; i <= N; i += len) calc(i, min(N, i + len - 1)); return ans; } int main() { int T; scanf("%d %lf %d", &N, &P, &T); ans.resize(N); 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 344 KB | Output is correct |
2 | Correct | 9 ms | 344 KB | Output is correct |
3 | Correct | 13 ms | 344 KB | Output is correct |
4 | Correct | 13 ms | 344 KB | Output is correct |
5 | Correct | 11 ms | 344 KB | Output is correct |
6 | Correct | 11 ms | 344 KB | Output is correct |
7 | Correct | 10 ms | 344 KB | Output is correct |
8 | Correct | 8 ms | 344 KB | Output is correct |
9 | Correct | 9 ms | 344 KB | Output is correct |
10 | Correct | 5 ms | 344 KB | Output is correct |
11 | Correct | 8 ms | 344 KB | Output is correct |
12 | Correct | 8 ms | 344 KB | Output is correct |
13 | Correct | 11 ms | 344 KB | Output is correct |
14 | Correct | 7 ms | 344 KB | Output is correct |
15 | Correct | 8 ms | 344 KB | Output is correct |
16 | Correct | 11 ms | 344 KB | Output is correct |
17 | Runtime error | 1 ms | 344 KB | Execution killed with signal 6 |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 344 KB | Output is correct (P=0.001, F=15.1, Q=20.6) -> 36.63 points |
2 | Correct | 136 ms | 344 KB | Output is correct (P=0.005256, F=51.1, Q=73.4) -> 32.78 points |
3 | Correct | 292 ms | 344 KB | Output is correct (P=0.011546, F=94.9, Q=143.3) -> 29.60 points |
4 | Correct | 615 ms | 344 KB | Output is correct (P=0.028545, F=191.5, Q=297.0) -> 28.09 points |
5 | Correct | 761 ms | 344 KB | Output is correct (P=0.039856, F=246.3, Q=380.6) -> 28.29 points |
6 | Correct | 1165 ms | 344 KB | Output is correct (P=0.068648, F=366.2, Q=562.8) -> 28.59 points |
7 | Correct | 1501 ms | 344 KB | Output is correct (P=0.104571, F=490.3, Q=745.3) -> 29.22 points |
8 | Correct | 1958 ms | 596 KB | Output is correct (P=0.158765, F=639.1, Q=961.0) -> 29.85 points |
9 | Correct | 2222 ms | 344 KB | Output is correct (P=0.2, F=731.4, Q=1105.7) -> 29.54 points |