# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
551888 | Antekb | Super Dango Maker (JOI22_dango3) | C++17 | 446 ms | 712 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 <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
namespace{
}
void Solve(int N, int M) {
vector<int> V(N*M);
for(int i=0; i<N*M; i++){
V[i]=i+1;
}
for(int j=0; j<M; j++){
shuffle(V.begin(), V.end(), rng);
vector<int> V2;
int l=1, r=V.size();
while(l<r){
int m=(l+r)>>1;
V2=V;
V2.resize(m);
if(Query(V2))r=m;
else l=m+1;
}
V2.clear();
vector<int> V3;
while(V.size()>l){
V3.push_back(V.back());
V.pop_back();
}
while(V.size()){
int x=V.back();
V.pop_back();
//cerr<<V.size()<<"a\n";
for(int i:V2)V.push_back(i);
//cerr<<V.size()<<"a\n";
int b=Query(V);
//cerr<<V.size()<<"a\n";
for(int i:V2)V.pop_back();
//cerr<<V.size()<<"a\n";
if(!b)V2.push_back(x);
else V3.push_back(x);
}
assert(V2.size()==N);
Answer(V2);
V=V3;
}
}
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... |