This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Ignut
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 123;
int n;
int a, b, c;
int colorA = 1, colorB = 2, colorC = 3;
vector<int> g[MAXN];
int vert = -1;
vector<int> res;
vector<int> order;
void dfs(int v, int par) {
order.push_back(v);
for (int to : g[v])
if (to != par)
dfs(to, v);
}
vector<int> find_split(int N, int A, int B, int C, vector<int> P, vector<int> Q) {
int M = P.size();
for (int i = 0; i < M; i ++) {
g[P[i]].push_back(Q[i]);
g[Q[i]].push_back(P[i]);
}
int start = 0;
for (int i = 0; i < N; i ++) {
if (g[i].size() == 1) {
start = i;
break;
}
}
dfs(start, -1);
res.assign(N, 3);
for (int i = 0; i < A; i ++)
res[order[i]] = 1;
for (int i = A; i < A + B; i ++)
res[order[i]] = 2;
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... |