# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244637 | 2020-07-04T13:18:00 Z | tqbfjotld | Pipes (CEOI15_pipes) | C++14 | 50 ms | 65540 KB |
#include <vector> #include <cstdio> using namespace std; #define MAXN 105 bool isBridge[MAXN]; int p[MAXN]; int sz[MAXN]; int depth[MAXN]; vector<int> adjl[MAXN]; int p2[MAXN]; int rt[MAXN]; void dfs(int node, int parent){ for (int x : adjl[node]){ if (x==parent) continue; depth[x] = depth[node]+1; rt[x] = rt[node]; 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(){ //printf("%d\n",sizeof(isBridge)+sizeof(p)+sizeof(sz)+sizeof(depth)+sizeof(adjl)+sizeof(p2)+sizeof(rt)); scanf("%d%d",&n,&e); for (int x = 1; x<=n; x++){ isBridge[x] = false; p[x] = x; sz[x] = 1; depth[x] = 0; rt[x] = x; } for (int x = 0; x<e; x++){ int a,b; scanf("%d%d",&a,&b); if (rt[a]==rt[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; rt[b] = rt[a]; dfs(b,a); isBridge[b] = true; } } for (int x = 1; x<=n; x++){ if (isBridge[x]){ printf("%d %d\n",x,p2[x]); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 50 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 416 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |