# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420808 | QCFium | Split the Attractions (IOI19_split) | C++14 | 3 ms | 332 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>
int ri() {
int n;
scanf("%d", &n);
return n;
}
static std::vector<std::vector<int> > hen;
std::vector<int> find_split(int n, int a, int b, int c, std::vector<int> p, std::vector<int> q) {
hen.resize(n);
for (int i = 0; i < (int) p.size(); i++) {
hen[p[i]].push_back(q[i]);
hen[q[i]].push_back(p[i]);
}
std::vector<int> res(n, -1);
if (a == 1) {
std::vector<bool> visited(n);
std::queue<int> que;
que.push(0);
visited[0] = true;
std::vector<int> group2;
while (que.size()) {
auto i = que.front();
que.pop();
group2.push_back(i);
if ((int) group2.size() == b) break;
for (auto j : hen[i]) if (!visited[j]) visited[j] = true, que.push(j);
}
for (auto i : group2) res[i] = 2;
*std::find(res.begin(), res.end(), -1) = 1;
for (auto &i : res) if (i == -1) i = 3;
}
}
#ifdef LOCAL
int main() {
return 0;
}
#endif
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... |