# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
34458 | bnahmad15 | Pipes (CEOI15_pipes) | C++14 | 213 ms | 9208 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;
const int N = 5010;
bitset< N > vis , vis2[N] , vis3[N];
vector< short > adj[N];
short dfs_low[N], dfs_num[N], num = 0 ;
int n , m , u , v , ans = 0 ;
void DFS(short node,short prnt){
vis[node]=true;
dfs_low[node]=dfs_num[node]=num++;
for (short i = 0;i<adj[node].size();i++){
if (adj[node][i]==prnt)
continue;
if (vis[adj[node][i]]){
dfs_low[node]=min(dfs_low[node],dfs_num[adj[node][i]]);
}
else {
DFS(adj[node][i],node);
if (dfs_num[node] < dfs_low[adj[node][i]] && !vis3[node][adj[node][i]]){
printf("%d %d\n",node,adj[node][i]);
}
dfs_low[node]=min(dfs_low[node],dfs_low[adj[node][i]]);
}
}
}
int main(){
scanf("%d%d",&n,&m);
for (int i = 0 ; i <m;i++){
scanf("%d%d",&u,&v);
if (vis2[u][v]){
vis3[u][v]=vis3[v][u]=true;
continue;
}
vis2[u][v]=vis2[v][u]=true;
adj[u].push_back(v);
adj[v].push_back(u);
}
for (int i = 1 ; i <= n;i++)
if (!vis[i])
DFS(i,-1);
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... |