# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
876846 |
2023-11-22T12:33:26 Z |
Hacv16 |
Pipes (CEOI15_pipes) |
C++17 |
|
297 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
int n, m, pre[MAX], low[MAX], seen[MAX], timer;
vector<int> adj[MAX];
vector<pair<int, int>> bridges;
void dfs(int u, int p)
{
seen[u] = true;
pre[u] = low[u] = ++timer;
for(auto v : adj[u])
{
if(v == p) continue;
if(!seen[v])
{
dfs(v, u);
low[u] = min(low[u], low[v]);
}else{
low[u] = min(low[u], pre[v]);
}
if(low[v] > pre[u]) bridges.emplace_back(u, v);
}
}
int32_t main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m;
while(m--)
{
int u, v; cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
for(int i = 1; i <= n; i++)
if(!seen[i]) dfs(i, i);
for(auto [u, v] : bridges)
cout << u << ' ' << v << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
12 ms |
51804 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
52568 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
94 ms |
65516 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
154 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
266 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
253 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
290 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
285 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
297 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
264 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |