# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28718 | 2017-07-16T09:02:05 Z | rondojim | Pipes (CEOI15_pipes) | C++14 | 1805 ms | 54088 KB |
#include <stdio.h> #include <vector> #include <algorithm> #include <set> using namespace std; const int MAXN = 8e4 + 5; typedef pair<int, int> edge; vector<int> adj[MAXN]; bool vis[MAXN]; int num[MAXN], low[MAXN], pos = 1, N, M; vector<edge> bridges; void dfs(int u, int p){ vis[u] = true; num[u] = pos++; low[u] = num[u]; for(int v : adj[u]){ if(vis[v] == false){ dfs(v, u); low[u] = min(low[u], low[v]); if(low[v] > num[u]) bridges.push_back((edge){min(v,u),max(v,u)}); } else if(v != p) low[u] = min(low[u], num[v]); } } int main(){ scanf("%d %d", &N, &M); int a, b; set<edge> S; while(M--){ scanf("%d %d", &a, &b); int aa = min(a, b), bb = max(a, b); edge p = {aa, bb}; adj[a].push_back(b); adj[b].push_back(a); } for(int i=1; i<=N; ++i) if(!vis[i]){ pos = 1; dfs(i, -1); } for(int i=0; i<bridges.size(); ++i) printf("%d %d\n", bridges[i].first, bridges[i].second); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2176 KB | Output is correct |
2 | Incorrect | 3 ms | 2176 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2816 KB | Output is correct |
2 | Incorrect | 6 ms | 2480 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 160 ms | 10380 KB | Output is correct |
2 | Correct | 160 ms | 9696 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 331 ms | 14156 KB | Output is correct |
2 | Runtime error | 384 ms | 18328 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 693 ms | 25380 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 | 1188 ms | 32148 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 | 1805 ms | 54088 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 | 6 ms | 4096 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 4096 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 | 4224 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |