# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422699 | oleh1421 | 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 "grader.cpp"
#include "split.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N=200010;
vector<int>g[N];
pair<int,int>gr[3];
int sz[N];
int P[N];
void dfs(int v,int pr){
sz[v]=1;
P[v]=pr;
for (int to:g[v]){
if (to!=pr){
dfs(to,v);
sz[v]+=sz[to];
}
}
}
int ans[N];
void Mark(int v,int ind){
if (!gr[ind].first) return;
gr[ind].first--;
ans[v]=gr[ind].second;
// if (!ind) cout<<"OK "<<v<<" "<<gr[ind].first<<" "<<gr[ind].second<<endl;
for (int to:g[v]){
if (ans[to]) continue;
Mark(to,ind);
}