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 "split.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100010];
int i, j, k, cnt;
vector<int>find_split(int n, int a, int b, int c, vector<int>p, vector<int>q)
{
vector<int>res(n);
for(i=0;i<n-1;i++)
{
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
}
for(i=0;i<n;i++)if(adj[i].size()==1)break;
res[i]=++cnt;
i=adj[i][0];
while(1)
{
res[i]=++cnt;
if(adj[i].size()==1)break;
if(res[adj[i][0]])i=adj[i][1];
else i=adj[i][0];
}
for(i=0;i<n;i++)
{
if(res[i]<=a)res[i]=1;
else if(res[i]<=b+a)res[i]=2;
else res[i]=3;
}
return res;
}
# | 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... |