# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
34456 | bnahmad15 | Pipes (CEOI15_pipes) | C++14 | 502 ms | 30428 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,u,v;
short tim = 0;
bool vis[10001]={false};
short low[10001]={0},disc[10001],parent[10001];
vector <short> adj[10001];
bitset < 10001 > vis2[10001],vis3[10001];
void DFS(short node){
vis[node] = true;
disc[node]=low[node]=++tim;
for (auto i : adj[node]){
if (!vis[i]){
parent[i]=node;
DFS(i);
low[node]=min(low[node],low[i]);
if (low[i] > disc[node] && !vis3[node][i]){
cout<<node+1<<" "<<i+1<<endl;
}
}
else if (i != parent[node])
low[node] = min(low[node],disc[i]);
}
}
void find_bridges(){
for (int i = 0 ; i< n;i++){
vis[i]=false;
parent[i]=-1;
disc[i]=0;
low[i]=0;
}
for (int i = 0; i<n;i++)
if (!vis[i])
DFS(i);
}
int main(){
scanf("%d%d",&n,&m);
for (int i= 0 ;i <m;i++){
scanf("%d%d",&u,&v);
u--;
v--;
adj[u].push_back(v);
adj[v].push_back(u);
if (vis2[u][v]){
vis3[u][v]=vis3[v][u]=true;
}
vis2[u][v]=vis2[v][u]=true;
}
find_bridges();
return 0;
}
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... |