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"
#include <bits/stdc++.h>
using namespace std;
namespace {
int query(set<int> st) {
vector<int> a;
for (int x : st) a.push_back(x);
return Query(a);
}
} // namespace
void Solve(int N, int M) {
vector<vector<int>> byGroup;
byGroup.resize(M);
for (int i=1; i<=N*M; i++) {
int lb=0, ub=M-1;
while (lb != ub) {
int mid=(lb+ub+1)/2;
set<int> s;
for (int j=1; j<=N*M; j++)
s.insert(j);
for (int j=0; j<mid; j++)
for (int x : byGroup[j])
s.erase(x);
s.erase(i);
int res = query(s);
if (res >= M - mid) ub = mid-1;
else lb = mid;
}
byGroup[lb].push_back(i);
}
for (int i=0; i<M; i++) {
Answer(byGroup[i]);
}
}
// #include "grader.cpp"
# | 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... |