# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
34382 | 2017-11-10T19:40:07 Z | mohammad_kilani | Pipes (CEOI15_pipes) | C++14 | 517 ms | 13300 KB |
#include <bits/stdc++.h> using namespace std; #define mod 1000007 #define oo 2000000000 const int M = 1500010 , N = 30011; bitset< N > vis; vector< short > g[N]; short dfs_low[N], dfs_num[N], num = 0 ; int n , m , u , v , ans = 0 ; void DFS(short node,short prnt){ vis[node] = true; dfs_low[node] = dfs_num[node] = num++; for(short i=0;i<g[node].size();i++){ if(g[node][i] == prnt) continue; if(vis[g[node][i]]){ dfs_low[node] = min(dfs_low[node],dfs_num[g[node][i]]); } else{ DFS(g[node][i],node); if(dfs_num[node] < dfs_low[g[node][i]]){ ++ans; printf("%d %d\n",min(node,g[node][i]),max(node,g[node][i])); } dfs_low[node] = min(dfs_low[node],dfs_low[g[node][i]]); } } } int main() { //freopen("in.txt","r",stdin); scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ scanf("%d%d",&u,&v); g[u].push_back(v); g[v].push_back(u); } for(short i=1;i<=n;i++){ if(vis[i] == false) DFS(i,-1); } if(ans == 0) puts(""); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1024 KB | Output is correct |
2 | Incorrect | 2 ms | 1024 KB | Wrong number of edges |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1408 KB | Output is correct |
2 | Incorrect | 7 ms | 1280 KB | Wrong number of edges |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 139 ms | 5232 KB | Output is correct |
2 | Correct | 143 ms | 4832 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 293 ms | 7264 KB | Output is correct |
2 | Correct | 316 ms | 9208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 517 ms | 13300 KB | Output is correct |
2 | Correct | 479 ms | 11604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1920 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1892 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1920 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |