# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244630 | 2020-07-04T13:05:18 Z | tqbfjotld | Pipes (CEOI15_pipes) | C++14 | 731 ms | 65540 KB |
#include <bits/stdc++.h> using namespace std; bool isBridge[100005]; int p[100005]; int sz[100005]; int depth[100005]; vector<int> adjl[100005]; int p2[100005]; void dfs(int node, int parent){ for (int x : adjl[node]){ if (x==parent) continue; depth[x] = depth[node]+1; dfs(x,node); if(p2[x]!=node){ isBridge[x] = isBridge[node]; p2[x] = node; } } } int root(int a){ return p[a]==a?a:p[a]=root(p[a]); } int func(int a, int b){ if (a==b) return a; if (depth[b]<depth[a]) swap(a,b); isBridge[b] = false; int t = func(a,p[b]); p[a] = t; p[b] = t; } int n,e; int main(){ scanf("%d%d",&n,&e); for (int x = 0; x<n; x++){ isBridge[x] = false; p[x] = x; sz[x] = 1; depth[x] = 0; } for (int x = 0; x<e; x++){ int a,b; scanf("%d%d",&a,&b); if (root(a)==root(b)){ func(a,b); } else{ if (sz[root(b)]>sz[root(a)]) swap(a,b); sz[root(a)] += sz[root(b)]; adjl[b].push_back(a); adjl[a].push_back(b); depth[b] = depth[a]+1; p2[b] = a; p[b] = a; dfs(b,a); isBridge[b] = true; } } for (int x = 0; x<n; x++){ if (isBridge[x]){ printf("%d %d\n",x,p2[x]); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 54 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 197 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 70 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 731 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 170 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 120 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 93 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 151 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 153 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 126 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |