# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975241 |
2024-05-04T15:22:33 Z |
duckindog |
Pipes (CEOI15_pipes) |
C++17 |
|
1288 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> ad;
vector<int> low, num;
int it;
void dfs(int u, int p = -1) {
low[u] = num[u] = ++it;
for (const auto& v : ad[u]) {
if (v == p) continue;
if (!low[v]) {
dfs(v, u);
low[u] = min(low[u], low[v]);
if (low[v] == num[v]) cout << u << " " << v << "\n";
} else low[u] = min(low[u], num[v]);
}
}
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m;
ad = vector<vector<int>> (n + 1);
for (int i = 1; i <= m; ++i) {
int u, v; cin >> u >> v;
ad[u].push_back(v);
ad[v].push_back(u);
}
low = num = vector<int>(n + 1);
for (int i = 1; i <= n; ++i) if (!low[i]) dfs(i);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1116 KB |
Output is correct |
2 |
Incorrect |
3 ms |
860 KB |
Wrong number of edges |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
11540 KB |
Output is correct |
2 |
Correct |
75 ms |
13136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
158 ms |
17232 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
279 ms |
31808 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
380 ms |
40152 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
708 ms |
65536 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
976 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1180 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1288 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |