# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443362 | leinad2 | Keys (IOI21_keys) | C++17 | 112 ms | 21492 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;
int par[210], chk[210];
int Find(int v){return v==par[v]?v:par[v]=Find(par[v]);}
vector<int>find_reachable(vector<int>r, vector<int>u, vector<int>v, vector<int>c)
{
int n, i, j, k, m, a, b;
n=r.size();m=c.size();
vector<int>ans;
ans.resize(n);
for(i=0;i<n;i++)par[i]=i;
for(i=0;i<m;i++)par[Find(u[i])]=Find(v[i]);
for(i=0;i<n;i++)chk[Find(i)]++;
for(i=0;i<n;i++)if(r[i]==0)ans[i]=chk[Find(i)];else ans[i]=1;
int x=1e9;for(i=0;i<n;i++)x=min(x, ans[i]);
for(i=0;i<n;i++)ans[i]=(ans[i]==x);
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... |