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 <bits/stdc++.h>
#include "split.h"
using namespace std;
const int N = 300000;
vector<int>graph[N];
int mark[N];
bool vis[N];
int baki;
void dfs(int at){
if(baki == 0)return;
mark[at] = 2;
baki--;
vis[at] = true;
for(auto i: graph[at]){
if(vis[i])continue;
dfs(i);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res(n,0);
// vector<int> something;
// something.push_back(a);
// something.push_back(c);
// something.push_back(b);
// sort(something.first(),something.second());
// a = something[0],b=something[1],c=something[2];
for(int i = 0; i < n;i++){
graph[p[i]].push_back(q[i]);
graph[q[i]].push_back(p[i]);
}
baki = b;
dfs(0);
for(int i = 0; i < n;i++){
if(!vis[i]){
vis[i] = true;
mark[i]= 1;
break;
}
}
for(int i = 0; i < n;i++){
if(!vis[i]){
vis[i] = true;
mark[i]= 3;
// break;
}
}
for(int i = 0; i < n;i++){
res[i] = mark[i];
}
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... |