제출 #630843

#제출 시각아이디문제언어결과실행 시간메모리
630843codr0Meetings (JOI19_meetings)C++14
29 / 100
2633 ms676 KiB
#include <bits/stdc++.h> #include "meetings.h" #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORR(i,a,b) for(int i=a;i>=b;i--) #define F first #define S second #define err(x) cerr<<#x<<" : "<<x<<'\n'; #define dmid int mid=(r+l)/2 #define lc 2*id #define rc 2*id+1 #define pb push_back #define all(x) x.begin(),x.end() #define SZ(x) (int)x.size() #define maxm(a,b) a=max(a,b) #define minm(a,b) a=min(a,b) using namespace std; void Solve(int n){ int h[n]={}; int par[n]={}; vector<int> vc[n]; FOR(i,1,n-2) FOR(j,i+1,n-1){ int x=Query(0,i,j); if(x==i) vc[j].pb(i); else if(x==j) vc[i].pb(j); } vector<pii> v0; FOR(i,1,n-1) v0.pb({SZ(vc[i]),i}); sort(all(v0)); for(pii vv:v0){ int v=vv.S; if(vv.F==0){ par[v]=0; h[v]=1; }else{ int H=-1; int pr=-1; for(int u:vc[v]) if(h[u]>H) H=h[u],pr=u; par[v]=pr; h[v]=h[pr]+1; } } FOR(i,1,n-1){ int a=par[i]; int b=i; if(a>b) swap(a,b); Bridge(a,b); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...