#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';
vi v;
f0r(i, N*M){
v.pb(i);
}
while(v.size() != 0){
int lst = v.size();
vi fx;
while(fx.size() < N){
// cout<<lst<<'\n';
int lo = 0;
int hi = lst - 1;
//first one such that can form stick, so this one is the first occurence of the dango
while(lo < hi){
// cout<<lo<<' '<<hi<<'\n';
int mid = (lo + hi) / 2;
vi quer;
for(auto u : fx){
quer.pb(u);
}
f0r(i, mid + 1){
quer.pb(v[i]);
}
int x = ask(quer);
// cout<<x<<'\n';
if(x >= 1){
hi = mid;
}
else{
lo = mid + 1;
}
}
// cout<<lo<<" LO"<<'\n';
lst = lo;
fx.pb(v[lst]);
}
// vout(fx);
ans(fx);
for(auto u : fx){
v.erase(find(v.begin(), v.end(), u));
}
// vout(v);
}
}
# | 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... |