Submission #978460

#TimeUsernameProblemLanguageResultExecution timeMemory
978460happy_nodeMeetings (JOI19_meetings)C++17
0 / 100
1714 ms988 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; vector<pair<int,int>> edges; void dfs(int root, vector<int> v) { if(v.size()==1) { return; } vector<int> curRoot; vector<vector<int>> items; for(auto u:v) { if(u==root) continue; int pt=0; bool fnd=0; for(auto r:curRoot) { // at this subtree int q=Query(root,r,u); if(q==r || q==u) { if(q==u) curRoot[pt]=u; items[pt].push_back(u); fnd=1; break; } // not at this subtree // do nothing pt++; } if(!fnd) { curRoot.push_back(u); items.push_back({u}); } } int pt=0; for(auto r:curRoot) { edges.push_back({root,r}); dfs(r,items[pt]); pt++; } } void Solve(int N) { vector<int> v; for(int i=0;i<N;i++) v.push_back(i); dfs(0,v); for(auto [u,v]:edges) { Bridge(u,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...