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;
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(s) (int)s.size()
#define ppb pop_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(1231229);
void Solve(int N, int M){
vector<vector<int>> cur;
for(int i=1;i<=N*M;i++){
cur.pb({i});
}
int del=0;
while(del<M-1){
// cout<<"! "<<del<<"\n";
// for(vector<int> vec:cur){
// for(int x:vec)cout<<x<<" ";
// cout<<"\n";
// }
shuffle(all(cur),rng);
vector<int> ask;
vector<int> ok;
for(int i=0;i<sz(cur)-1;i++){
for(int j:cur[i])ask.pb(j);
}
for(int i=sz(cur)-2;i>=0;i--){
if(Query(ask)==M-1-del){
ok.pb(i);
}
else break;
for(int j=0;j<sz(cur[i]);j++)ask.ppb();
}
if(sz(ok)==1){
vector<int> vec=cur.back();
cur.ppb();
for(int x:vec){
cur.pb({x});
}
}
// cout<<"? "<<sz(ok)<<"\n";
ok.ppb();
vector<int> vec=cur.back();
cur.ppb();
for(int i=0;i<sz(ok);i++){
for(int x:cur.back()){
vec.pb(x);
}
cur.ppb();
}
if(sz(vec)==N){
// assert(0);
// for(int x:vec)cout<<x<<" ";
// cout<<"\n";
// for(auto x:cur){
// for(int y:x)cout<<y<<" ";
// cout<<"\n";
// }
Answer(vec);
del++;
}
else{
cur.pb(vec);
}
}
vector<int> vec;
for(auto v:cur){
for(int x:v)vec.pb(x);
}
Answer(vec);
}
# | 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... |