Submission #940904

#TimeUsernameProblemLanguageResultExecution timeMemory
940904daoquanglinh2007Toxic Gene (NOI23_toxic)C++17
9.46 / 100
8 ms504 KiB
#include <bits/stdc++.h> #include "toxic.h" using namespace std; #define isz(a) (int)(a).size() const int NM = 300; char a[NM+5]; void determine_type(int n){ for (int i = 1; i <= n; i++){ a[i] = ' '; } int cur = 0; for (int i = 1; i <= n; i++){ vector <int> species = {}; species.push_back(i); if (query_sample(species) == 0){ a[i] = 'T'; cur = i; } } while (true){ vector <int> arr = {}, species = {}; for (int i = 1; i <= n; i++){ if (a[i] == ' ' && isz(arr) < 8) arr.push_back(i); } if (arr.empty()) break; for (int i = 0; i < isz(arr); i++){ for (int j = 0; j < (1<<i); j++) species.push_back(arr[i]); } species.push_back(cur); int tmp = query_sample(species); for (int i = 0; i < isz(arr); i++) if ((tmp>>i)&1) a[arr[i]] = 'S'; else a[arr[i]] = 'R'; } for (int i = 1; i <= n; i++) answer_type(i, a[i]); }
#Verdict Execution timeMemoryGrader output
Fetching results...