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;
int N,M,A,B,C, deg[100005];
vector<int> lst[100005], ans;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
N = n, M = p.size(), A = a, B = b, C = c;
memset(deg,0,sizeof(deg));
for (int i = 0; i < M; ++i) lst[p[i]].push_back(q[i]), lst[q[i]].push_back(p[i]);
int root = -1;
for (int i = 0; i < N; ++i) if (lst[i].size() == 1) root = i;
ans.assign(N,0);
for (int i = 0; i < N; ++i) {
if (i < A) ans[root] = 1;
else if (i < A+B) ans[root] = 2;
else ans[root] = 3;
if (i != N-1) {
if (ans[lst[root][0]] == 0) root = lst[root][0];
else root = lst[root][1];
}
}
return ans;
}
# | 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... |