Submission #1014279

#TimeUsernameProblemLanguageResultExecution timeMemory
1014279thangdz2k7Meetings (JOI19_meetings)C++17
0 / 100
28 ms664 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; void Ans(int u, int v){ if (u < v) Bridge(u, v); else Bridge(v, u); } void Solve(vector <int> v){ if (v.size() < 2) return; random_shuffle(v.begin(), v.end()); int l = v[0], r = v[1]; map <int, vector <int>> m; vector <int> path; for (auto k : v){ if (k == l || k == r) continue; int x = Query(l, r, k); if (!m.count(x)) path.push_back(x); m[x].push_back(k); } sort(path.begin(), path.end(), [&](int x, int y){ return Query(v[0], x, y) == x; }); int last = v[0]; for (auto k : path) Ans(last, k), last = k; Ans(last, v[1]); for (auto it : m) Solve(it.second); } void Solve(int n){ srand(time(0)); vector <int> cur(n, 0); for (int i = 1; i < n; ++ i) cur[i] = i; Solve(cur); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...