# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429747 | rumen_m | Split the Attractions (IOI19_split) | C++17 | 3 ms | 2652 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 maxn = 1e5+5;
vector<int> res;
vector <int> g[maxn];
int leftt;
void dfs(int v, int par)
{
res[v] = 2;
int i;
if(leftt==0)return ;
for(auto u:g[v])
{
if(res[u]!=0)continue;
leftt--;
dfs(u,v);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
res.resize(n);
int i;
for(i=0;i<p.size();i++)
{
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
if(a==1)
{
leftt = b;
dfs(0,-1);
bool fl = false;
for(i=0;i<n;i++)
{
if(res[i])continue;
if(!fl){res[i] = 1; fl=true;}
else
res[i] = 3;
}
}
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... |