# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226158 | AaronNaidu | Split the Attractions (IOI19_split) | C++14 | 118 ms | 12788 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> graph[100001];
int n, a, b, c, num;
bool visited[100001];
vector<int> toRet;
void dfs(int node) {
visited[node] = true;
if (num < a)
{
toRet[node] = 1;
}
else if (num < a + b)
{
toRet[node] = 2;
}
num++;
for (auto i : graph[node])
{
if (!visited[i])
{
dfs(i);
}
}
}
vector<int> find_split(int ln, int la, int lb, int lc, vector<int> p, vector<int> q) {
n = ln;
a = la;
b = lb;
c = lc;
for (int i = 0; i < p.size(); i++)
{
graph[p[i]].push_back(q[i]);
graph[q[i]].push_back(p[i]);
}
for (int i = 0; i < n; i++)
{
toRet.push_back(3);
}
num = 0;
bool found = false;
for (int i = 0; i < n; i++)
{
if (graph[i].size() == 1)
{
dfs(i);
found = true;
break;
}
}
if (!found)
{
dfs(0);
}
return toRet;
}
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... |