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 Query(x);
}
void a(vector<int> v) {
for (auto &t : v) {
t++;
}
Answer(v);
}
} // namespace
void Solve(int N, int M) {
S = N * M;
vector<vector<int>> dangobox(M);
for (int i = 0; i < S; i++) {
int l, r;
l = -1;
r = M - 1;
while (l + 1 != r) {
int m = (l + r) / 2;
vector<bool> b(S, true);
for (int j = 0; j <= m; j++) {
for (int t : dangobox[j]) {
b[t] = false;
}
}
b[i] = false;
if (q(b) == M - m - 2)
l = m;
else
r = m;
}
dangobox[r].push_back(i);
}
for (int i = 0; i < M; i++) {
a(dangobox[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |