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< vector< int > > Graph;
vector< int > colouring;
vector< bool > visited;
int remaining;
void dfs(int node){
visited[node] = true;
if(remaining--) colouring[node] = 2;
for(int a : Graph[node]){
if(visited[a]) continue;
dfs(a);
}
}
vector<int> find_split(int N, int a, int b, int c, vector<int> p, vector<int> q) {
Graph.resize(N);
colouring.resize(N);
visited.assign(N, false);
remaining = b;
for(int i = 0; i < N; i++){
Graph[p[i]].push_back(q[i]);
Graph[q[i]].push_back(p[i]);
}
dfs(0);
for(int i = 0; i < N; i++){
if(colouring[i] == 2) continue;
if(a--) colouring[i] = 1;
else colouring[i] = 3;
}
return colouring;
}
# | 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... |