# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521604 | eecs | Keys (IOI21_keys) | C++17 | 1644 ms | 53292 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 "keys.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_reachable(vector<int> r, vector<int> U, vector<int> V, vector<int> C) {
int n = r.size(), mn = INT_MAX;
vector<vector<array<int, 2>>> G(n);
for (int i = 0; i < U.size(); i++) {
G[U[i]].push_back({V[i], C[i]});
G[V[i]].push_back({U[i], C[i]});
}
vector<int> ans, perm(n), pos(n), cnt(n), vis(n, -1), visc(n, -1);
vector<vector<int>> cand(n);
vector<bool> solved(n);
iota(perm.begin(), perm.end(), 0);
for (int i = 0; i < n; i++) {
for (auto &e : G[i]) cnt[i] += e[1] == r[i];
}
sort(perm.begin(), perm.end(), [&](int u, int v) { return cnt[u] < cnt[v]; });
for (int i = 0; i < n; i++) {
pos[perm[i]] = i;
}
for (int i = 0; i < n; i++) {
sort(G[i].begin(), G[i].end(), [&](array<int, 2> p, array<int, 2> q) { return pos[p[0]] < pos[q[0]]; });
}
queue<int> Q;
vector<int> ver, col;
for (int x : perm) {
ver = {x}, col.clear();
while (!Q.empty()) Q.pop();
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... |