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 "meetings.h"
#include <bits/stdc++.h>
using namespace std;
int lca[2005][2005];
void dfs(int u, vector<int> possible){
for(int v: possible){
if(u == v){throw;}
bool boleh = true;
for(int x: possible){
if(lca[v][x] == v || lca[v][x] == u){
}else{
boleh = false;
break;
}
}
if(boleh){
vector<int> possible2;
for(int x: possible){
if(lca[v][x] == v && v != x){
possible2.push_back(x);
}
}
Bridge(min(u, v), max(u, v));
dfs(v, possible2);
}
}
}
void Solve(int N) {
lca[0][0] = 0;
for(int i = 1; i < N; i ++){
lca[0][i] = 0;
lca[i][0] = 0;
}
for(int i = 1; i < N; i ++){
lca[i][i] = i;
for(int j = i+1; j < N; j ++){
lca[i][j] = Query(0, i, j);
lca[j][i] = lca[i][j];
}
}
vector<int> possible;
for(int i = 1; i < N; i ++){
possible.push_back(i);
}
dfs(0, possible);
}
# | 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... |