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>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
using namespace std;
vector<vi>G;
vi res;
int cant=0;
int B;
void dfs(int nodo){
if(cant>=B)return;
res[nodo]=2;
cant++;
for(auto it : G[nodo]){
if(res[it]==2)continue;
dfs(it);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
int m=p.size();
G.assign(n,vi());
for(int i=0;i<m;i++){
G[p[i]].pb(q[i]);
G[q[i]].pb(p[i]);
}
res.assign(n,3);
B=b;
dfs(0);
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... |