# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609555 | Ozy | Keys (IOI21_keys) | C++17 | 0 ms | 0 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.
rep(i,0,n-1) uf[i] = {i,1};
rep(i,0,m-1) une(u[i],v[i]);
peor = 1<<30;
vector<int> res;
res.resize(n,0);
rep(i,0,n-1) {
if (r[i] != 0) res[i] = 1;
else {
a = sube(i);
res[i] = uf[a].num;
}
peor = min(res[i],peor);
}
rep(i,0,n-1) if (res[i] == peor) res[i] = 1;
else res[i] = 0;
return res;
}