# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951820 | EJIC_B_KEDAX | Super Dango Maker (JOI22_dango3) | C++17 | 100 ms | 768 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 <bits/stdc++.h>
#include "dango3.h"
using ll = long long;
using namespace std;
mt19937_64 mt(chrono::high_resolution_clock::now().time_since_epoch().count());
void Solve(int n, int m) {
vector<int> have(n * m);
for (int i = 0; i < n * m; i++) {
have[i] = i + 1;
}
for (int _ = 0; _ < m; _++) {
shuffle(have.begin(), have.end(), mt);
vector<int> nw;
int l = n - 1, r = have.size();
while (r - l > 1) {
int mid = (r + l) / 2;
nw.clear();
for (int i = 0; i <= mid; i++) {
nw.push_back(have[i]);
}
if (Query(nw)) {
r = mid;
} else {
l = mid;
}
}
nw.clear();
for (int i = 0; i <= r; i++) {
nw.push_back(have[i]);
}
for (int i = 0; i < nw.size() && nw.size() > n; i++) {
int tmp = nw[i];
swap(nw[i], nw.back());
nw.pop_back();
if (!Query(nw)) {
nw.push_back(tmp);
swap(nw[i], nw.back());
} else {
i--;
}
}
Answer(nw);
unordered_set<int> st;
vector<int> have2;
for (int i : nw) {
st.insert(i);
}
for (int i : have) {
if (st.find(i) == st.end()) {
have2.push_back(i);
}
}
swap(have, have2);
}
}
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... |