# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601857 | Minindu2006 | Split the Attractions (IOI19_split) | C++14 | 542 ms | 1048576 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;
const int MX = 1e5 + 5;
vector<int> adj[MX], vis(MX, 0);
void dfs(int i, vector<int> &tre)
{
vis[i] = 1;
tre.push_back(i);
for(auto a:adj[i])
{
if(!vis[a])
dfs(i, tre);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res(n, 3);
int m = p.size();
for(int i=0;i<m;i++)
{
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
}
int st = -1, numC = INT_MAX;
for(int i=0;i<n;i++)
{
if(numC > (adj[i].size()))
numC = (adj[i].size()), st = i;
}
vector<int> path;
dfs(st, path);
for(int i=0;i<a;i++)
res[path[i]] = 1;
for(int i=a;i<a+b;i++)
res[path[i]] = 2;
return res;
}
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... |