# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502870 | waynetuinfor | Keys (IOI21_keys) | C++17 | 3093 ms | 25660 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 <algorithm>
#include <vector>
std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u,
std::vector<int> v, std::vector<int> c) {
int N = r.size(), M = u.size();
std::vector<std::vector<int>> g(N);
std::vector<std::vector<int>> keys(N);
for (int e = 0; e < M; ++e) {
g[u[e]].push_back(e);
g[v[e]].push_back(e);
keys[c[e]].push_back(e);
}
std::vector<bool> vis(N);
std::vector<bool> got(N);
std::vector<int> p(N);
for (int x = 0; x < N; ++x) {
std::fill(vis.begin(), vis.end(), false);
std::fill(got.begin(), got.end(), false);
std::vector<int> que;
auto Push = [&](int p) {
if (got[p]) {
return;
}
got[p] = true;
for (int e : keys[p]) {
if (vis[u[e]] && !vis[v[e]]) {
vis[v[e]] = true;
Compilation message (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... |