# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031264 | Marco_Escandon | Split the Attractions (IOI19_split) | 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.
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define x first
#define y second
vector<ll> cad[100005];
vector<ll> sts,sol;
ll aux=0;pair<ll,ll> st={1e9,1e9};
ll dfs(ll node){
if(sts[node]!=0) return 0;
sts[node]=1;
for(auto i:cad[node])
sts[node]+=dfs(i);
if(sts[node]>=aux)
st=min(st,{sts[node],node});
return sts[node];
}
void fillst(ll node, ll c, ll cnt)
{
sol[node]=c;cnt--;
queue<ll>q;q.push(node);
while(!q.empty())
{
for(auto i:cad[q.front()])
{
if(sts[i]<sts[q.front()]&&sol[i]==0&&cnt>0)
{
sol[i]=c;
cnt--;
q.push(i);