# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
804588 | 2023-08-03T10:00:57 Z | Hanksburger | Pipes (CEOI15_pipes) | C++17 | 877 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; int par[100005][2], tin[100005], low[100005], visited[100005], t; vector<int> adj[100005]; int findPar(int u, int x) { return (par[u][x]==u?u:par[u][x]=findPar(par[u][x], x)); } void dfs(int u, int p) { tin[u]=low[u]=(++t); visited[u]=1; int pass=1; for (int v:adj[u]) { if (v==p && pass) { pass=0; continue; } if (visited[v]) low[u]=min(low[u], tin[v]); else { dfs(v, u); low[u]=min(low[u], low[v]); if (low[v]>=tin[v]) cout << u << ' ' << v << '\n'; } } } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i=1; i<=n; i++) par[i][0]=par[i][1]=i; for (int i=1; i<=m; i++) { int u, v, U, V; cin >> u >> v; if (findPar(u, 0)!=findPar(v, 0)) { par[par[u][0]][0]=par[v][0]; adj[u].push_back(v); adj[v].push_back(u); } else if (findPar(u, 1)!=findPar(v, 1)) { par[par[u][1]][1]=par[v][1]; adj[u].push_back(v); adj[v].push_back(u); } } for (int i=1; i<=n; i++) if (!visited[i]) dfs(i, 0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 3156 KB | Output is correct |
2 | Correct | 6 ms | 3024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 3096 KB | Output is correct |
2 | Correct | 73 ms | 2828 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 122 ms | 3896 KB | Output is correct |
2 | Correct | 142 ms | 3240 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 239 ms | 5596 KB | Output is correct |
2 | Correct | 175 ms | 5208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 11540 KB | Output is correct |
2 | Correct | 281 ms | 7432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 481 ms | 12812 KB | Output is correct |
2 | Runtime error | 431 ms | 42968 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 590 ms | 15240 KB | Output is correct |
2 | Runtime error | 656 ms | 50936 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 699 ms | 15248 KB | Output is correct |
2 | Runtime error | 725 ms | 62508 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 820 ms | 14616 KB | Output is correct |
2 | Runtime error | 877 ms | 65536 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |