#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int N, int M) {
bool used[N*M];
memset(used,0,sizeof(used));
for(int i=0;i<M;i++) {
vector<int> cur(N, -1);
int prevL = (M - i) * N;
for(int j=0;j<N;j++) {
int l = 0, h = prevL;
while(h - l > 1) {
int m = (l + h) / 2;
vector<int> qry;
int ptr = 0;
while(qry.size() < m) {
if(!used[ptr])
qry.push_back(ptr+1);
ptr++;
}
for(auto k: cur)
if(~k)
qry.push_back(k);
if(Query(qry))
h = m;
else
l = m;
}
int ptr = -1, cnt = 0;
while(cnt <= l) {
if(!used[++ptr])
cnt++;
}
used[ptr] = 1;
cur[j] = ptr+1;
prevL = l;
}
Answer(cur);
}
}
# | 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... |