# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244512 | dwsc | Pipes (CEOI15_pipes) | C++14 | 1308 ms | 13692 KiB |
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>
using namespace std;
int n,m;
vector<short> adj[30010];
int low[30010],num[30010],parent[30010];
int counter;
void articulationPoint(int u){
// cout << u;
low[u] = num[u] = counter++;
int parentcount = 0;
for (int j = 0; j < adj[u].size(); j++){
int v = adj[u][j];
if (num[v] == -1){
parent[v] = u;
articulationPoint(v);
if (low[v] > num[u]) cout << u << " " << v << "\n";
low[u] = min(low[u],low[v]);
}
else if (v != parent[u]){
low[u] = min(low[u],low[v]);
}
else if (v == parent[u]){
parentcount++;
if (parentcount > 1) low[u] = min(low[u],low[v]);
}
}
}
int main(){
cin >> n >> m;
for (int i = 0; i < m; i++){
int a,b;
cin >> a >> b;
adj[a].push_back(b);
adj[b].push_back(a);
}
for (int i = 1; i <= n; i++){
num[i] = -1;
}
for (int i = 1;i <= n; i++) if (num[i] == -1) articulationPoint(i);
}
Compilation message (stderr)
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |