# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869637 | willychan | Super Dango Maker (JOI22_dango3) | C++17 | 1206 ms | 956 KiB |
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 <vector>
#include<random>
#include<algorithm>
#include<iostream>
#include<cassert>
using namespace std;
namespace {
int variable_example = 1;
int n,m;
} // namespace
void process(vector<int> &get,vector<int> &pos){
int k = pos.size();
random_shuffle(pos.begin(),pos.end());
vector<int> a;
for(int i=1;i<k;i++) a.push_back(pos[i]);
vector<bool> notin(k,0);
notin[0]=1;
int should = (k/n)-1;
for(int i=1;i<k;i++){
notin[i]=1;
vector<int> q;
for(int i=0;i<k;i++) if(!notin[i]) q.push_back(pos[i]);
int g = Query(q);
if(g!=should) notin[i]=0;
}
for(int i=0;i<k;i++) if(notin[i]) get.push_back(pos[i]);
}
void Solve(int N, int M) {
n = N;m = M;
vector<int> pos(N*M);
vector<bool> in(N*M+1);
for(int i=0;i<N*M;i++) pos[i] = i+1;
for(int i=0;i<M-1;i++){
vector<int> get;
process(get,pos);
for(auto i : get) in[i]=1;
assert(get.size()==n);
Answer(get);
vector<int> temp;
for(auto i : pos) if(!in[i]) temp.push_back(i);
swap(pos,temp);
}
Answer(pos);
/*for(auto i : pos) ans.push_back(i);
for(int i=0;i<M;i++){
vector<int> ret;
for(int j=0;j<N;j++){
ret.push_back(ans[j*N+i]);
}
Answer(ret);
}*/
}
Compilation message (stderr)
# | 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... |