# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996295 | abczz | Super Dango Maker (JOI22_dango3) | C++17 | 111 ms | 1128 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 <iostream>
#include <vector>
#include <map>
#include <random>
#include <algorithm>
#define ll int
using namespace std;
void Solve(int N, int M) {
mt19937_64 mt(69);
vector <ll> perm;
map <ll, ll> mp;
ll pos[10001];
ll s;
for (int i=1; i<=N*M; ++i) {
perm.push_back(i);
}
shuffle(perm.begin(), perm.end(), mt);
for (int i=0; i<N*M; ++i) {
mp[i] = perm[i];
pos[perm[i]] = i;
}
vector <ll> V;
for (int i=0; i<M; ++i) {
for (auto [x, y] : mp) {
V.push_back(y);
if (V.size() >= N) {
s = Query(V);
if (s) break;
}
}
for (int j=0; j<(ll)V.size(); ++j) {
auto u = V[j];
swap(V[j], V.back());
V.pop_back();
s = Query(V);
if (!s) {
V.push_back(u);
swap(V[j], V.back());
}
else --j;
if (V.size() == N) break;
}
for (auto u : V) {
mp.erase(pos[u]);
}
Answer(V);
V.clear();
}
}
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... |