# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
876847 |
2023-11-22T12:34:18 Z |
Hacv16 |
Pipes (CEOI15_pipes) |
C++17 |
|
2660 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 70010;
const int INF = 0x3f3f3f3f;
int n, m, pre[MAX], low[MAX], timer;
bool seen[MAX];
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 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2652 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3164 KB |
Output is correct |
2 |
Incorrect |
3 ms |
2908 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
10676 KB |
Output is correct |
2 |
Correct |
75 ms |
15532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
144 ms |
17976 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
263 ms |
41436 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
426 ms |
52312 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2660 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
4956 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
4952 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1251 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |