# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169931 | socho | Split the Attractions (IOI19_split) | C++14 | 1145 ms | 1048580 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"
#include "split.h"
using namespace std;
int A, B, C, N;
const int MXN = 100005;
vector<int> adj[MXN];
int res[MXN];
vector<int> order;
void dfsord(int node, int last) {
order.push_back(node);
for (int i=0; i<adj[node].size(); i++) {
int ot = adj[node][i];
if (ot == last) continue;
dfsord(ot, node);
return;
}
}
void line(int end) {
dfsord(end, -1);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
A = a;
B = b;
C = c;
N = n;
for (int i=0; i<p.size(); i++) {
if (i == n - 1) continue;
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
}
int mn = 0;
for (int i=0; i<n; i++) {
if (adj[i].size() < adj[mn].size()) {
mn = i;
}
}
line(mn);
vector<int> re;
for (int i=0; i<n; i++) {
if (i < a) re.push_back(1);
else if (i - a < b) re.push_back(2);
else re.push_back(3);
}
return re;
}
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... |