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;
const int nax = 1e5 + 3;
//subtask 1
vector<int>g[nax];
int m, n;
vector<int>stk;
void dfs(int v, int p) {
stk.push_back(v);
for(int u : g[v]) if(u!=p && u!=stk[0]) {
dfs(u, v);
}
}
vector<int> find_split(int N, int a, int b, int c,
vector<int> p, vector<int> q) {
n = N;
int st = 0;
for(int i=0; i<n; ++i) if(g[i].size()==1) {
st = i;
break;
}
dfs(st, st);
vector<int>res(n, 0);
for(int i=0; i<n; ++i) {
if(i<a) res[stk[i]] = 1;
else if(i<a+b) res[stk[i]] = 2;
else res[stk[i]] = 3;
}
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... |