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;
#define endl "\n"
// #define int long long
typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
int use[200010];
vector<int> v[200010] , seq;
void dfs(int u ){
seq.push_back(u);
use[u] = 1;
for(auto x : v[u])
if(!use[x]){
dfs(x);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res;
int m = p.size();
for(int i = 0 ; i < m ; ++i) {
v[p[i]].push_back(q[i]);
v[q[i]].push_back(p[i]);
}
dfs(0);
if(b > c){
res = vector<int>(n , 2);
for(int i = 0 ; i < c ; ++i) res[seq[i]] = 3;
for(int i = 0 ; i < n ; ++i) if(res[i] == 2){
res[i] = 1;
break;
}
}else{
res = vector<int>(n , 3);
// cout << seq[0]
for(int i = 0 ; i < b ; ++i) res[seq[i]] = 2;
for(int i = 0 ; i < n ; ++i) if(res[i] == 3){
res[i] = 1;
break;
}
}
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... |