# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1084685 | 2024-09-06T16:51:51 Z | SulA | Pipes (CEOI15_pipes) | C++17 | 1381 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; vector<int> adj[100000]; vector<bool> multi_edge[100000]; int dep[100000], low[100000]; void dfs(int v, int p, bool multi = false) { low[v] = dep[v] = dep[p] + 1; for (int j = 0; j < adj[v].size(); j++) { int ch = adj[v][j]; if (ch == p) continue; if (dep[ch] == 0) { dfs(ch, v, multi_edge[v][j]); low[v] = min(low[v], low[ch]); } else { low[v] = min(low[v], dep[ch]); } } if (low[v] == dep[v] && v != p && !multi) { cout << v+1 << " " << p+1 << "\n"; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n,m; cin >> n >> m; while (m--) { int u,v; cin >> u >> v; adj[--u].push_back(--v); adj[v].push_back(u); } for (int i = 0; i < n; i++) { sort(adj[i].begin(), adj[i].end()); multi_edge[i].resize(adj[i].size()); for (int j = 0; j < adj[i].size(); j++) { if (j != 0 && adj[i][j-1] == adj[i][j]) { multi_edge[i][j] = true; } if (j != adj[i].size()-1 && adj[i][j+1] == adj[i][j]) { multi_edge[i][j] = true; } } } for (int i = 0; i < n; i++) if (dep[i] == 0) dfs(i, i); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 6492 KB | Output is correct |
2 | Correct | 3 ms | 6492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 7260 KB | Output is correct |
2 | Correct | 5 ms | 6976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 113 ms | 20228 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 198 ms | 27796 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 327 ms | 44956 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 430 ms | 54864 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 781 ms | 65536 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 994 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1381 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1028 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |