#include <bits/stdc++.h>
using namespace std;
#include "dango3.h"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(a) a.begin(), a.end()
#include <vector>
namespace {
int variable_example = 1;
} // namespace
void Solve(int N, int M) {
vector<vector<int>> groups(M);
FOR(i,1,N*M+1){
int l = 0; int r = M-1;
int u = -1;
while (l < r){
int mid = (l+r)/2;
set<int> j;
vector<int> e;
for (auto x: groups[mid]) j.insert(x);
FOR(k,1,N*M+1){
if (j.count(k) == 0 && k != i) e.pb(k);
}
int o = M-Query(e);
if (o == 2){
if (l+1 == r){
u = r;
break;
}
l = mid;
}else{
if (l+1 == r) u = l;
r = mid;
}
}
groups[u].pb(i);
}
FOR(i,0,M){
Answer(groups[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... |