# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582739 | elkernos | Super Dango Maker (JOI22_dango3) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dango3.h"
using namespace std;
namespace {
int S;
int q(vector<bool> b)
{
vector<int> x;
for(int i = 0; i < S; i++) {
if(b[i]) x.push_back(i + 1);
}
return Pytaj(x);
}
void a(vector<int> v)
{
for(auto &t : v) {
t++;
}
Odpowiedz(v);
}
} // namespace
void Inicjuj(int N, int M)
{
S = N * M;
vector<vector<int>> box(M);
for(int i = 0; i < S; i++) {
int lo = 0, hi = M - 1, ans = -1;
while(lo <= hi) {
int m = (lo + hi) / 2;
vector<bool> query(S, 1);
for(int x : box[m]) {
query[x] = 0;
}
query[i] = 0;
if(M - q(query) == 2) {
lo = m + 1;
}
else {
ans = m;
hi = m - 1;
}
}
box[ans].push_back(i);
}
for(vector<int> give : box) {
a(give);
}
}