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<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q){
int m = p.size();
vector<vector<int>> g(n);
for (int i=0; i<m; i++){
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
vector<int> res(n, 3);
vector<bool> seen(n, false);
int i = 0;
queue<int> qu;
qu.push(0);
while (i<b){
int cur = qu.front();
qu.pop();
if (seen[cur]) continue;
seen[cur] = true;
res[cur] = 2;
i++;
for (int next : g[cur]) qu.push(next);
}
for (int j=0; j<n; j++){
if (res[j] == 3){
res[j] = 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... |