# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
205798 | 2020-03-01T00:44:05 Z | Mamnoon_Siam | Pipes (CEOI15_pipes) | C++17 | 101 ms | 14204 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; using vi = vector<int>; const int N = 1e5 + 5; int n, m; struct dsu { int par[N]; dsu() { memset(par, 0, sizeof par); iota(par, par + N, 0); } int find(int u) { return u == par[u] ? u : par[u] = find(par[u]); } int unite(int u, int v) { u = find(u), v = find(v); if(u == v) return 0; par[u] = v; return 1; } } ds1, ds2; int low[N], in[N], tym = 0; vector<int> g[N]; void dfs(int u, int dad = 0) { in[u] = low[u] = ++tym; for(int v : g[u]) if(v != dad) { if(in[v]) { low[u] = min(low[u], in[v]); } else { dfs(v, u); low[u] = min(low[u], low[v]); if(low[v] > in[u]) { printf("%d %d\n", u, v); } } } } int main(int argc, char const *argv[]) { #ifdef LOCAL freopen("in", "r", stdin); #endif scanf("%d %d", &n, &m); for(int i = 0; i < m; i++) { int u, v; scanf("%d %d", &u, &v); if(ds1.unite(u, v) or ds2.unite(u, v)) { g[u].emplace_back(v); g[v].emplace_back(u); } else { assert(false); } } for(int i = 1; i <= n; i++) { if(!in[i]) { dfs(i); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 6776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 14 ms | 7160 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 7160 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 19 ms | 7820 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 33 ms | 8888 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 75 ms | 11384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 93 ms | 12280 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 91 ms | 12896 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 97 ms | 14204 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 101 ms | 13944 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |