# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948338 |
2024-03-18T04:28:42 Z |
vjudge1 |
Pipes (CEOI15_pipes) |
C++17 |
|
900 ms |
65536 KB |
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int N=1e5+5;
vector <int> g[N];
int vis[N],tin[N],low[N];
int t=0;
map <pair <int,int>,int> mp;
vector <pair <int,int> > ans;
void dfs(int v,int p){
vis[v]=1;
t++;
tin[v]=t;
low[v]=t;
for(auto to : g[v]){
if(to!=p){
if(vis[to])low[v]=min(low[v],tin[to]);
else{
dfs(to,v);
low[v]=min(low[v],low[to]);
if(low[to]>tin[v]){
ans.pb({v,to});
}
}
}
}
}
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
int u,v;
cin>>u>>v;
g[u].pb(v);
g[v].pb(u);
mp[{u,v}]++;
mp[{v,u}]++;
}
for(int i=1;i<=n;i++){
if(!vis[i])dfs(i,0);
}
for(auto x : ans){
if(mp[x]==1)cout<<x.ff<<" "<<x.ss<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2908 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
4956 KB |
Output is correct |
2 |
Correct |
11 ms |
4796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
751 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
792 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
813 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
884 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
818 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
886 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
900 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
831 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |