# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28717 | 2017-07-16T09:01:09 Z | rondojim | Pipes (CEOI15_pipes) | C++14 | 2413 ms | 65536 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}; if(S.find(p) != S.end()) continue; S.insert(p); 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 | 4 ms | 2148 KB | Output is correct |
2 | Incorrect | 4 ms | 2176 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 3300 KB | Output is correct |
2 | Incorrect | 11 ms | 3072 KB | Wrong number of edges |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1191 ms | 36836 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 | 2357 ms | 60336 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 | 2145 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 | 2363 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 | 2413 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 | 5 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 | 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 | 4116 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |