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> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q){
int m = p.size();
vector<vector<int>> g(n);
for (int i = 0; i < m; i++){
int u = p[i], v = q[i];
g[u].push_back(v);
g[v].push_back(u);
}
vector<bool> vis(n);
vector<int> ans(n, 3);
function<void(int)> dfs = [&](int u){
vis[u] = 1;
if (b > 0){
ans[u] = 2;
b--;
}
for (auto &v: g[u]){
if (vis[v]) continue;
dfs(v);
}
};
dfs(0);
for (int i = 0; i < n; i++){
if (ans[i] == 3){
ans[i] = 1;
break;
}
}
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... |