# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1029385 | Szil | Super Dango Maker (JOI22_dango3) | C++17 | 108 ms | 604 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;
namespace {
mt19937 rng(42);
}
/*
4 4
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
*/
void Solve(int N, int M) {
vector<int> v(N*M);
iota(v.begin(), v.end(), 1);
while (!v.empty()) {
shuffle(v.begin(), v.end(), rng);
int lo = 0, hi = v.size() - 1;
while (lo < hi) {
int mid = (lo + hi) / 2;
if (Query(vector<int>(v.begin(), v.begin()+mid+1)) == 0) {
lo = mid + 1;
} else {
hi = mid;
}
}
vector<int> x(v.begin(), v.begin()+lo+1);
for (auto it = x.begin(); it != x.end() && x.size() != N; ) {
vector<int> y = x;
y.erase(find(y.begin(), y.end(), *it));
if (Query(y) == 1) {
it = x.erase(it);
} else {
it++;
} }
for (int a : x) {
v.erase(find(v.begin(), v.end(), a));
}
assert(x.size() == N);
Answer(x);
}
}
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... |