# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
297140 | Azimjon | Split the Attractions (IOI19_split) | C++17 | 73 ms | 8952 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>
using namespace std;
typedef vector<int> vi;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
int m = p.size();
vector<vi> g(n, vi());
for (int i = 0; i < m; i++) {
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
vi jv(n, 0);
int bo, ox;
for (int i = 0; i < n; i++)
if (g[i].size() == 1) {
bo = i;
break;
}
for (int i = 0; i < n; i++)
if (g[i].size() == 1 && i != bo) {
ox = i;
break;
}
for (int i = 0; i < a; i++) {
jv[bo] = 1;
if (g[bo].size() == 2) {
if (jv[g[bo][0]])
bo = g[bo][1];
else
bo = g[bo][0];
}
else
bo = g[bo][0];
}
for (int i = 0; i < b; i++) {
jv[ox] = 2;
if (g[ox].size() == 2) {
if (jv[g[ox][0]])
ox = g[ox][1];
else
ox = g[ox][0];
}
else
ox = g[ox][0];
}
for (int &i : jv)
if (i == 0)
i = 3;
return jv;
}
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... |