# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
311493 | Kenzo_1114 | Pipes (CEOI15_pipes) | C++17 | 1586 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 10001;
int n, m, low[MAXN], depth[MAXN];
vector<int> graph[MAXN];
map<pair<int, int> , bool> marc;
void dfs(int v, int p)
{
depth[v] = (v == p) ? 0 : depth[p] + 1;
low[v] = depth[v];
bool first = false;
for(int i = 0; i < graph[v].size(); i++)
{
int u = graph[v][i];
if(low[u] >= 0)
{
if(u != p || first) low[v] = min(low[v], depth[u]);
if(u == p) first = true;
continue;
}
dfs(u, v);
low[v] = min(low[v], low[u]);
if(low[u] > depth[v]) printf("%d %d\n", u, v);
}
}
int main ()
{
scanf("%d %d", &n, &m);
for(int i = 1; i <= n; i++) low[i] = -1;
for(int i = 0, u, v; i < m; i++)
{
scanf("%d %d", &u, &v);
if(marc[{u, v}]) continue;
marc[{u, v}] = true;
graph[u].push_back(v);
graph[v].push_back(u);
}
for(int i = 1; i <= n; i++)
if(low[i] == -1) dfs(i, i);
}
/*
10 11
1 7
1 8
1 6
2 8
6 7
5 8
2 5
2 3
2 4
3 4
10 9
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |