# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370992 | KoD | Simurgh (IOI17_simurgh) | C++17 | 331 ms | 4712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "simurgh.h"
template <class T>
using Vec = std::vector<T>;
Vec<int> find_roads(int n, Vec<int> U, Vec<int> V) {
Vec<Vec<std::pair<int, int>>> graph(n);
const int m = (int) U.size();
for (int i = 0; i < m; ++i) {
graph[U[i]].emplace_back(V[i], i);
graph[V[i]].emplace_back(U[i], i);
}
Vec<char> visited(n);
Vec<int> depth(n), pedge(n, -1);
Vec<int> edges;
std::set<int> tree;
auto dfs = [&](auto dfs, const int u) -> void {
visited[u] = true;
for (const auto [v, e]: graph[u]) {
if (visited[v]) {
if (depth[u] + 1 < depth[v]) {
edges.push_back(e);
}
}
else {
depth[v] = depth[u] + 1;
pedge[v] = e;
tree.insert(e);
dfs(dfs, v);
# | 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... |