#include "dango3.h"
#include<bits/stdc++.h>
#define pb push_back
#define vi vector<int>
#define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n';
#define f0r(i,n) for(int i = 0; i<n; i++)
using namespace std;
vi perm;
int ask(vi quer){
vi q;
// cout<<"QUER "<<' ';
for(auto u : quer){
q.pb(perm[u]);
// cout<<u<<' ';
}
// cout<<'\n';
int x = Query(q);
return x;
}
void ans(vi a){
vi ret;
for(auto u : a){
ret.pb(perm[u]);
}
Answer(ret);
}
void Solve(int N, int M) {
f0r(i, N*M){
perm.pb(i + 1);
}
random_shuffle(perm.begin(), perm.end());
// for(auto u : perm)cout<<u<<' ';
// cout<<'\n';
vector<vi> answers(M);
vi unanswer;
f0r(i, N*M)unanswer.pb(i);
f0r(i, N * M){
unanswer.erase(find(unanswer.begin(), unanswer.end(), i));
int lo = 0;
int hi = M - 1;
while(lo < hi){
// cout<<lo<<' '<<hi<<'\n';
int mid = lo + (hi - lo + 1) / 2;
vi quer;
for(auto u : unanswer)quer.pb(u);
f0r(j, mid){
for(auto u : answers[j])quer.pb(u);
}
int x = ask(quer);
if(x == M - 1 - (M - (mid))){
hi = mid - 1;
}
else{
lo = mid;
}
}
answers[lo].pb(i);
}
for(auto u : answers)ans(u);
}
# | 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... |