# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1222533 | Ariadna | COVID tests (CEOI24_covid) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "template.cpp"
using namespace std;
mt19937 rng;
int n;
double p;
void recorrer_arbre(int l, int r, vector<bool>& ans) {
if (l == r) {
ans[l] = 1;
return;
}
vector<bool> a(n, 0);
int m = (l+r)/2;
for (int i = l; i <= m; ++i) a[i] = 1;
bool aux = test_students(a);
for (int i = l; i <= m; ++i) a[i] = 0;
if (aux) {
recorrer_arbre(l, m, ans);
for (int i = m+1; i <= r; ++i) a[i] = 1;
int aux = test_students(a);
if (aux) recorrer_arbre(m+1, r, ans);
} else recorrer_arbre(m+1, r, ans);
}
bool ok = true;
vector<bool> find_positive() {
vector<int> idx(n);
for (int i = 0; i < n; ++i) idx[i] = i;
shuffle(idx.begin(), idx.end(), rng);
vector<bool> a(n, 1);
vector<bool> ans(n, 0);
if (test_students(a)) recorrer_arbre(0, n-1, ans);
}