# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
156323 | 2019-10-05T06:38:51 Z | Akashi | Pipes (CEOI15_pipes) | C++14 | 3159 ms | 65540 KB |
#include <bits/stdc++.h> using namespace std; struct dsu{ int TT[100005]; void init(int n){ for(int i = 1; i <= n ; ++i) TT[i] = i; } void unite(int x, int y){TT[x] = y;} int find(int x){ int R = x; while(R != TT[R]) R = TT[R]; while(x != TT[x]){ int aux = TT[x]; TT[x] = R; x = aux; } return R; } }; dsu A, B; int n, m; int low[100005], h[100005]; bitset <100002> viz; vector <int> v[100005]; void tarjan(int nod, int papa = 0){ viz[nod] = 1; for(auto it : v[nod]){ if(papa == it) continue ; if(!viz[it]){ low[it] = h[it] = h[nod] + 1; tarjan(it, nod); low[nod] = min(low[nod], low[it]); if(low[it] > h[nod]) printf("%d %d\n", it, nod); } else low[nod] = min(h[it], low[nod]); } } int main() { scanf("%d%d", &n, &m); A.init(n); B.init(n); int x, y; for(int i = 1; i <= m ; ++i){ scanf("%d%d", &x, &y); if(A.find(x) != A.find(y)){ v[x].push_back(y); v[y].push_back(x); A.unite(A.find(x), A.find(y)); } else if(B.find(x) != B.find(y)){ v[x].push_back(y); v[y].push_back(x); A.unite(A.find(x), A.find(y)); } } for(int i = 1; i <= n ; ++i) if(!viz[i]) tarjan(i); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Incorrect | 4 ms | 2808 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3192 KB | Output is correct |
2 | Incorrect | 9 ms | 2936 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 200 ms | 10912 KB | Output is correct |
2 | Correct | 187 ms | 10204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 371 ms | 14312 KB | Output is correct |
2 | Runtime error | 437 ms | 30072 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 656 ms | 25192 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 | 1000 ms | 30964 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 | 1694 ms | 65536 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 | 2457 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 | 3122 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3159 ms | 65540 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |