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];
bool used[MAXN];
int vert = -1;
vector<int> res;
vector<int> order;
void dfs(int v) {
used[v] = true;
order.push_back(v);
for (int to : g[v])
if (!used[to])
dfs(to);
}
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]);
}
for (int i = 0; i < N; i ++) {
if (used[i]) continue;
if (g[i].size() != 1) continue;
dfs(i);
}
for (int i = 0; i < N; i ++) {
if (used[i]) continue;
dfs(i);
}
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... |