# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941439 | Programmer123 | Split the Attractions (IOI19_split) | C++17 | 1901 ms | 19536 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 "split.h"
#include <bits/stdc++.h>
std::vector<int> find_split(int n, int a, int b, int c, std::vector<int> p, std::vector<int> q) {
auto start_t = clock();
std::vector<int> res(n);
std::vector<int> connections[n];
for (int i = 0; i < p.size(); ++i) {
connections[p[i]].push_back(q[i]);
connections[q[i]].push_back(p[i]);
}
bool s1 = true;
for (int i = 0; i < n; ++i) {
if (connections[i].size() > 2) s1 = false;
}
if (s1) {
int start = 0;
for (int i = 0; i < n; ++i) {
if (connections[i].size() == 1) {
start = i;
break;
}
}
std::vector<int> order;
while (order.size() < n) {
order.push_back(start);
int next = connections[start][0];
if (connections[next].size() == 2 && connections[next][0] == start) {
std::swap(connections[next][0], connections[next][1]);
}
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... |