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;
int N,M,A,B,C;
vector<int> lst[100005], ans;
queue<int> Q;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
N = n, M = p.size(), A = a, B = b, C = c;
for (int i = 0; i < M; ++i) lst[p[i]].push_back(q[i]), lst[q[i]].push_back(p[i]);
ans.assign(N,3);
ans[0] = 2;
Q.push(0);
int cnt = 1;
while (!Q.empty() && cnt < B) {
int u = Q.front(); Q.pop();
for (int v: lst[u]) if (ans[v] == 3) {
ans[v] = 2, cnt++;
Q.push(v);
if (cnt >= B) break;
}
}
for (int i = 0; i < N; ++i) if (ans[i] == 3) {
ans[i] = 1;
break;
}
return ans;
}
# | 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... |