Submission #674012

#TimeUsernameProblemLanguageResultExecution timeMemory
674012peijarSuper Dango Maker (JOI22_dango3)C++17
100 / 100
621 ms592 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int randint(int lb, int ub) { return uniform_int_distribution<int>(lb, ub)(rng); } void Solve(int nbCouleurs, int parCouleur) { int tot = nbCouleurs * parCouleur; vector<bool> killed(tot); for (int iBloc = 0; iBloc < parCouleur; ++iBloc) { vector<int> restant; for (int i = 0; i < tot; ++i) if (!killed[i]) restant.push_back(i); shuffle(restant.begin(), restant.end(), rng); int nb = 0; for (int p = (int)log2(restant.size()); p >= 0; --p) { vector<int> q; if (nb + (1 << p) > (int)restant.size()) continue; for (int i = 0; i < nb + (1 << p); ++i) q.push_back(restant[i] + 1); if (Query(q) == 0) nb += 1 << p; } ++nb; vector<int> crucial; for (int i = 0; i < nb; ++i) crucial.push_back(restant[i]); for (int i = 0; i < (int)crucial.size(); ++i) { vector<int> q; for (int x : crucial) if (x != crucial[i]) q.push_back(x + 1); if (Query(q)) { swap(crucial[i], crucial.back()); crucial.pop_back(); --i; } } assert((int)crucial.size() == nbCouleurs); vector<int> q; for (int x : crucial) q.push_back(x + 1); Answer(q); for (int x : crucial) killed[x] = true; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...