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"
//#include "grader.cpp"
using namespace std;
#define MAX_N 2003
int comm_anc[MAX_N][MAX_N];
set <int> anc[MAX_N] ,sbtree[MAX_N];
void Solve(int N) {
for(int u=1; u<N; u++)
for(int v=u+1; v<N; v++){
int o = comm_anc[v][u] = comm_anc[u][v] = Query(0 ,u ,v);
sbtree[o].insert(u) ,sbtree[o].insert(v);
anc[v].insert(o) ,anc[u].insert(o);
}
for(int i=1; i<N; i++){
pair <int ,int> mi = {1e9 ,-1};
for(auto&u : anc[i])
if(u != i)
mi = min(mi ,make_pair((int)sbtree[u].size() ,u));
assert(mi.second != -1);
Bridge(min(i ,mi.second) ,max(i ,mi.second));
//cout << i << ' ' << mi.second << endl;
}
}
# | 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... |