# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
434618 | KoD | One-Way Streets (CEOI17_oneway) | C++17 | 324 ms | 28356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
template <class T> using Vec = std::vector<T>;
int main() {
int N, M;
std::cin >> N >> M;
Vec<Vec<std::pair<int, int>>> graph(N);
Vec<int> A(M), B(M);
for (int i = 0; i < M; ++i) {
std::cin >> A[i] >> B[i];
A[i] -= 1;
B[i] -= 1;
graph[A[i]].emplace_back(B[i], i);
graph[B[i]].emplace_back(A[i], i);
}
Vec<Vec<int>> children(N);
Vec<int> sum(N), parent(N, -1), depth(N, -1);
auto dfs = [&](auto&& dfs, const int u) -> void {
for (const auto [v, e] : graph[u]) {
if (e != parent[u]) {
if (depth[v] == -1) {
parent[v] = e;
depth[v] = depth[u] + 1;
children[u].push_back(v);
dfs(dfs, v);
sum[u] += sum[v];
} else if (depth[v] < depth[u]) {
sum[u] += 1;
sum[v] -= 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |