# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290579 | Pichon5 | Split the Attractions (IOI19_split) | C++17 | 75 ms | 8196 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>
#define pb push_back
using namespace std;
vector<vector<int> >G;
vector<int>res;
int aux=0;
int cc=1;
void dfs(int nodo,int x,int padre){
if(aux==x){
return;
}
res[nodo]=cc;
aux++;
for(int i=0;i<G[nodo].size();i++){
if(G[nodo][i]!=padre){
dfs(G[nodo][i],x,nodo);
}
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
G.assign(n,vector<int>());
for(int i=0;i<p.size();i++){
G[p[i]].pb(q[i]);
G[q[i]].pb(p[i]);
}
res.assign(n,3);
for(int i=0;i<n;i++){
if(G[i].size()==1 && cc==1){
dfs(i,a,-1);
aux=0;
cc++;
continue;
}
if(G[i].size()==1 && cc==2){
dfs(i,b,-1);
break;
}
}
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... |