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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
const ll N = 100005;
vector <int> path;
bool vis[N];
vector <vector <int> > adj(N);
void dfs(ll v) {
vis[v] = true;
for(auto &u: adj[v]) {
if(vis[u]) continue;
dfs(u);
}
path.pb(v);
return;
}
vector <int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q) {
int m = p.size(), i;
for(i = 0; i < m; i++) {
adj[p[i]].pb(q[i]);
adj[q[i]].pb(p[i]);
}
dfs(0);
vector <int> ans(n, 0);
for(i = 0; i < a; i++)
ans[path[i]] = 1;
for(i = a; i < a + b; i++)
ans[path[i]] = 2;
for(i = a + b; i < n; i++)
ans[path[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... |