# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112046 | onlk97 | Super Dango Maker (JOI22_dango3) | C++17 | 124 ms | 780 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>
#include <vector>
using namespace std;
const int THRES=2000;
namespace {
int variable_example = 1;
} // namespace
void Solve(int N, int M){
random_device rd;
mt19937 mt(rd());
vector <int> rem;
for (int i=1; i<=N*M; i++) rem.push_back(i);
for (int i=1; i<M; i++){
br:;
shuffle(rem.begin(),rem.end(),mt);
vector <int> v;
vector <int> orirem=rem;
for (int j=0; j<THRES&&!rem.empty(); j++){
v.push_back(rem.back());
rem.pop_back();
}
if (!Query(v)){
for (int j:v) rem.push_back(j);
goto br;
}
while (v.size()>N){
vector <int> tp=v;
int ba=tp.back();
tp.pop_back();
if (!Query(tp)) tp.insert(tp.begin(),ba);
v=tp;
}
set <int> sv;
for (int j:v) sv.insert(j);
vector <int> nw;
rem=orirem;
for (int j:rem){
if (sv.find(j)==sv.end()) nw.push_back(j);
}
rem=nw;
Answer(v);
}
Answer(rem);
}
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... |