# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54795 | 2018-07-05T05:48:04 Z | 김세빈(#1509) | Pipes (CEOI15_pipes) | C++11 | 3149 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; vector <int> V[101010]; int K[101010], T[101010]; bool chk[101010]; int n, m, cnt; void dfs(int p) { K[p] = ++cnt; for(auto t: V[p]){ if(!K[t]) dfs(t); } } int dfs2(int p, int r) { int ret, k, f; chk[p] = 1; f = 0; ret = k = K[p]; for(auto t: V[p]){ if(!chk[t]) ret = min(ret, dfs2(t, p)); else if(t == r){ if(f++) ret = min(ret, K[t]); } else ret = min(ret, K[t]); } if(ret == k && r != 0) printf("%d %d\n", p, r); return K[p] = ret; } int main() { int i, a, b; scanf("%d%d", &n, &m); for(i=1;i<=m;i++){ scanf("%d%d", &a, &b); V[a].push_back(b); V[b].push_back(a); } for(i=1;i<=n;i++){ if(!K[i]) dfs(i); } for(i=1;i<=n;i++){ if(!chk[i]) dfs2(i, 0); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2688 KB | Output is correct |
2 | Correct | 4 ms | 2688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3200 KB | Output is correct |
2 | Correct | 8 ms | 2944 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 158 ms | 10780 KB | Output is correct |
2 | Correct | 168 ms | 10196 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 359 ms | 14288 KB | Output is correct |
2 | Runtime error | 383 ms | 18552 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 678 ms | 25044 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1065 ms | 30280 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1863 ms | 51840 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2458 ms | 65476 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3048 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 | 3149 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |