# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040002 | LaMatematica14 | Split the Attractions (IOI19_split) | C++17 | 1 ms | 436 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.
#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) {
vector<int> g(n, 3);
vector<vector<int>> adj(n);
for (int i = 0; i < p.size(); i++) {
adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]);
}
queue<int> nx;
nx.push(0); g[0] = 2;
while (!nx.empty()) {
int att = nx.front(); nx.pop();
for (int i : adj[att]) {
if (b == 0) break;
if (g[i] == 2) continue;
nx.push(i);
g[i] = 2;
b--;
}
if (b == 0) break;
}
for (int i = 0; i < n; i++) {
if (g[i] == 3) {
g[i] = 1; break;
}
}
return g;
}
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... |