# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077688 | Ignut | Split the Attractions (IOI19_split) | C++17 | 73 ms | 10112 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Ignut
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 123;
int n;
int a, b, c;
int colorA = 1, colorB = 2, colorC = 3;
vector<int> g[MAXN];
int vert = -1;
vector<int> res;
int lim;
void dfs(int v, int col) {
res[v] = col;
lim --;
if (lim == 0) return;
for (int to : g[v]) {
if (res[to] != 3)
continue;
if (lim == 0) return;
dfs(to, col);
if (lim == 0) return;
}
}
vector<int> find_split(int N, int A, int B, int C, vector<int> P, vector<int> Q) {
int M = P.size();
for (int i = 0; i < M; i ++) {
g[P[i]].push_back(Q[i]);
g[Q[i]].push_back(P[i]);
}
res.assign(N, 3);
vector<pair<int, int>> vec;
for (int i = 0; i < N; i ++) vec.push_back({g[i].size(), i});
vert = vec[0].second;
res[vert] = 1;
int start = 0;
if (start == vert) start ++;
lim = B;
dfs(start, 2);
if (lim != 0) N /= 0;
return res;
}
Compilation message (stderr)
# | 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... |