# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244540 | 2020-07-04T09:26:42 Z | tqbfjotld | Pipes (CEOI15_pipes) | C++14 | 2750 ms | 65540 KB |
///lib code still allowed right #include <vector> #include <utility> #include <cstdio> #include <cstring> using namespace std; int low[100005]; int order[100005]; int cur = 1; vector<int > adjl[100005]; int root = 0; int temp[100005]; ///ensure no duplicate edges first though void dfs(int node, int parent){ order[node] = cur; cur++; low[node] = order[node]; for (auto x : adjl[node]){ temp[x]++; } for (auto x : adjl[node]){ if (temp[x]==0) continue; temp[x]--; bool thing = false; if (temp[x]!=0) { thing = true; temp[x] = 0; } if (order[x]==-1){ dfs(x,thing?-1:node); if (low[node]==-1 || (low[x]!=-1 && low[x]<low[node])){ low[node] = low[x]; } if (node!=root){ if (low[x]==-1 || low[x]>=order[node]){ } } else{ } } else if (x!=parent){ if (low[node]==-1 || order[x]<low[node]) low[node] = order[x]; } } } //ans is number of components after removing node (>1 if is articulation point) //bridge break a component if it is removed //HAVE NOT TESTED YET (but should be correct though) inline bool isBridge(int a, int b){ if (order[b]<order[a]) swap(a,b); return low[b]>order[a]; } int n,e; int main(){ scanf("%d%d",&n,&e); for (int x = 0; x<e; x++){ int a,b; scanf("%d%d",&a,&b); a--;b--; adjl[a].push_back(b); adjl[b].push_back(a); } memset(low,-1,sizeof(low)); memset(order,-1,sizeof(order)); for (root = 0; root<n; root++){ if (order[root]==-1) dfs(root,-1); } for (int x = 0; x<n; x++){ //printf("%d: order: %d, low: %d\n",1+x,order[x],low[x]); } for (int x = 0; x<n; x++){ for (auto y : adjl[x]){ if (y<x){ if (isBridge(x,y)){ printf("%d %d\n",x+1,y+1); } } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 3456 KB | Output is correct |
2 | Correct | 6 ms | 3456 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 3840 KB | Output is correct |
2 | Correct | 11 ms | 3712 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 171 ms | 11512 KB | Output is correct |
2 | Correct | 171 ms | 10872 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 321 ms | 14712 KB | Output is correct |
2 | Runtime error | 391 ms | 19448 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 588 ms | 25208 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 943 ms | 29816 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1690 ms | 51448 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2115 ms | 64508 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2527 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 | 2750 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |