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);
int x = 0 , y = 0 , sz = 0 , sz1 = 0 ;
if(a >= max(b , c)) res = vector<int>(n , 1) , x = 3 , y = 2 , sz = c ,sz1 = b;
else if(b >= c) res = vector<int>(n , 2) , x = 3 , y = 1 , sz = c ,sz1 = a;
else res = vector<int>(n , 3) , x = 1 , y = 2 , sz = a ,sz1 = b;
for(int i = 0 ; i < sz ; ++i) res[seq[i]] = x;
reverse(seq.begin(), seq.end());
for(int i = 0 ; i < sz1 ; ++i) res[seq[i]] = y;
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... |