# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145424 | JovanK26 | Split the Attractions (IOI19_split) | C++14 | 2 ms | 376 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;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q)
{
vector<int> rez(n);
vector<int> v[n];
for(int i=0;i<p.size();i++)
{
v[p[i]].push_back(q[i]);
v[q[i]].push_back(p[i]);
}
if(a==1)
{
queue<int> q;
bool vis[n];
for(int i=0;i<n;i++)
{
rez[i]=0;
vis[i]=0;
}
rez[0]=1;
int br=0;
q.push(0);
vis[0]=1;
while(!q.empty())
{
int node=q.front();
q.pop();
rez[node]=2;
br++;
if(br==b)break;
for(int i=0;i<v[node].size();i++)
{
if(!vis[v[node][i]])
{
vis[v[node][i]]=1;
q.push(v[node][i]);
}
}
}
for(int i=0;i<n;i++)
{
if(!rez[i])rez[i]=3;
}
}
return rez;
}
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... |