# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
603516 | Siffer | Keys (IOI21_keys) | C++17 | 3062 ms | 13016 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>
using namespace std;
vector<int> find_reachable(vector<int> r, vector<int> u, vector<int> v, vector<int> c) {
int n = r.size();
vector<int> ans(n, 0);
vector<bool> vi(n, 0);
vector<bool> keys(n, 0);
int m = n;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) vi[j] = 0, keys[j] = 0;
vi[i] = 1;
keys[r[i]] = 1;
for(int k = 0; k < n; k++) {
for(int j = 0; j < u.size(); j++) {
if(vi[u[j]] && keys[c[j]]) vi[v[j]] = 1, keys[r[v[j]]] = 1;
if(vi[v[j]] && keys[c[j]]) vi[u[j]] = 1, keys[r[u[j]]] = 1;
}
}
int c = 0;
for(int j = 0; j < n; j++) if(vi[j]) c++;
m = min(c, m);
ans[i] = c;
}
for(int i = 0; i < n; i++) ans[i] = ans[i] == m ? 1 : 0;
return ans;
}
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... |