# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092897 | Pannda | Meetings (JOI19_meetings) | C++17 | 1055 ms | 1672 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 "meetings.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int n) {
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
auto work = [&](auto self, vector<int> dom) -> void {
shuffle(dom.begin(), dom.end(), rng);
int r = dom.back();
dom.pop_back();
vector<vector<int>> branches;
vector<int> heads;
for (int u : dom) {
bool found = false;
for (int i = 0; !found && i < heads.size(); i++) {
int get = Query(r, u, heads[i]);
if (get == r) {
// nothing
} else if (get == u) {
heads[i] = u;
branches[i].push_back(u);
found = true;
} else {
branches[i].push_back(u);
found = true;
}
}
if (!found) {
heads.push_back(u);
branches.push_back({u});
}
}
for (int u : heads) {
if (r < u) Bridge(r, u);
else Bridge(u, r);
}
for (vector<int> branch : branches) {
self(self, branch);
}
};
work(work, [&]() -> vector<int> {
vector<int> dom(n);
iota(dom.begin(), dom.end(), 0);
return dom;
}());
}
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... |