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 <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 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... |