#include "split.h"
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;
const int mxn = 1e5 + 5;
vi adj[mxn]; int vis[mxn]; int deg[mxn]; vi ans; int cur = 0;
int a1, b1, c1;
void dfs(int node) {
if (cur == b1) return;
ans[node] = 2; cur++;
vis[node] = 1;
for (auto neighbour : adj[node]) {
if (vis[neighbour]) continue;
dfs(neighbour);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
a1 = a; b1 = b; c1 = c;
int m = p.size();
ans.resize(n);
for (int i = 0; i < m; i++) {
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
deg[p[i]]++; deg[q[i]]++;
}
dfs(0);
for (int i = 0; i < n; i++) {
if (!ans[i]) {
ans[i] = 1;
break;
}
}
for (int i = 0; i < n; i++) {
if (!ans[i]) {
ans[i] = 3;
}
}
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... |