제출 #1190793

#제출 시각아이디문제언어결과실행 시간메모리
1190793Ghulam_JunaidMeetings (JOI19_meetings)C++20
0 / 100
25 ms516 KiB
#include <bits/stdc++.h> #include "meetings.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MXN = 2005; int n, root; vector<int> subt[MXN]; bool cmp(int u, int v){ if (Query(root, u, v) == u) return u; return v; } void get(int v){ int u = subt[v][rng() % subt[v].size()]; vector<int> path, cur_subt = subt[v]; subt[v].clear(); for (int x : cur_subt){ if (x == u) continue; int cen = Query(u, x, v); if (cen == x) path.push_back(x); else subt[cen].push_back(x); } root = v; sort(path.begin(), path.end(), cmp); path.push_back(u); for (int i = 0; i < path.size(); i ++) Bridge(root, path[i]), root = path[i]; } void Solve(int nn) { n = nn; for (int i = 1; i < n; i ++) subt[0].push_back(i); for (int v = 0; v < n; v ++){ if (subt[v].empty()) continue; get(v); v--; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...