#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=2005;
vector<pair<int,int>> edges;
bool vis[MX];
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;
for(auto r:curRoot) {
// at this subtree
int q=Query(root,r,u);
if(q==root) {
// not at this subtree
pt++;
continue;
}
// at this subtree
curRoot[pt]=q;
if(!vis[q]) items[pt].push_back(q);
vis[q]=true;
if(!vis[u]) items[pt].push_back(u);
vis[u]=true;
break;
}
if(!vis[u]) {
curRoot.push_back(u);
items.push_back({u});
}
}
for(auto u:v) {
vis[u]=false;
}
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);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
600 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |