Submission #674003

#TimeUsernameProblemLanguageResultExecution timeMemory
674003peijarSuper Dango Maker (JOI22_dango3)C++17
7 / 100
485 ms648 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; void Solve(int nbCouleurs, int parCouleur) { vector<vector<int>> sol(parCouleur); vector<int> bef; int tot = nbCouleurs * parCouleur; vector<bool> killed(tot); for (int iCouleur = 0; iCouleur < nbCouleurs; ++iCouleur) { int lo = 0, up = tot - 1; while (lo < up) { int mid = (lo + up) / 2; vector<int> toQuery = bef; for (int i = 0; i <= mid; ++i) if (!killed[i]) toQuery.push_back(i + 1); if (Query(toQuery) >= 1) up = mid; else lo = mid + 1; } vector<int> almostAll = bef; for (int i = 0; i < lo; ++i) if (!killed[i]) almostAll.push_back(i + 1); int prv = lo; killed[prv] = true; sol[0].push_back(prv + 1); for (int iEl = 1; iEl < parCouleur; ++iEl) { lo = prv + 1, up = tot - 1; while (lo < up) { int mid = (lo + up) / 2; vector<int> toQuery = almostAll; for (int i = prv + 1; i <= mid; ++i) if (!killed[i]) toQuery.push_back(i + 1); if (Query(toQuery) >= 1) up = mid; else lo = mid + 1; } killed[lo] = true; sol[iEl].push_back(lo + 1); prv = lo; } bef.push_back(prv + 1); } for (auto &s : sol) Answer(s); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...