# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959304 | 2024-04-07T23:17:08 Z | Cyber_Wolf | Pipes (CEOI15_pipes) | C++17 | 325 ms | 20564 KB |
#include <bits/stdc++.h> using namespace std; const int N = 7e4+5; vector<int> adj[N]; int tin[N], par[N][2], low[N]; int get1(int src) { return par[src][0] = (src == par[src][0] ? src : get1(par[src][0])); } int get2(int src) { return par[src][1] = (src == par[src][1] ? src : get2(par[src][1])); } int n, m, tmp, pa = -1; void dfs(int src) { bool a = false; tin[src] = low[src] = ++tmp; for(auto it : adj[src]) { if(it == pa && !a) { a = true; continue; } if(tin[it]) { low[src] = min(low[src], tin[it]); continue; } pa = src; dfs(it); low[src] = min(low[src], low[it]); if(low[it] > tin[src]) { printf("%d %d\n", src, it); } } return ; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); scanf("%d%d", &n, &m); for(int i = 1; i <= n; i++) par[i][0] = par[i][1] = i; int u, v, pU, pV; while(m--) { scanf("%d%d", &u, &v); pU = get1(u), pV = get1(v); if(pU != pV) { par[pU][0] = pV; adj[u].push_back(v), adj[v].push_back(u); } else{ pU = get2(u), pV = get2(v); if(pU != pV) { par[pU][1] = pV; adj[u].push_back(v), adj[v].push_back(u); } } } for(int i = 1; i <= n; i++) { if(!tin[i]) dfs(i); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2908 KB | Wrong number of edges |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 3420 KB | Wrong number of edges |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 84 ms | 3164 KB | Output is correct |
2 | Incorrect | 93 ms | 3164 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 148 ms | 3664 KB | Output is correct |
2 | Incorrect | 178 ms | 3380 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 258 ms | 5012 KB | Output is correct |
2 | Incorrect | 212 ms | 4848 KB | Wrong number of edges |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 325 ms | 9136 KB | Output is correct |
2 | Runtime error | 285 ms | 20564 KB | Memory limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 5720 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 5724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 5724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 5724 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |