# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
348028 | beksultan04 | Split the Attractions (IOI19_split) | C++17 | 0 ms | 0 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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin()Ñ,s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
vector <int> v;
bool vis[100001];
int index[100001];
vector <int> g[100001];
void dfs(int x,int p){
vis[x]=1;
for (int to : g[x]){
if (to != p && vis[to] == 0)dfs(to,x);
}
v.pb(x);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> res;
int i,j,s=0;
for (i=0;i<p.size();++i){
g[p[i]].pb(q[i]);
g[q[i]].pb(p[i]);
}
for (i=0;i<n;++i){
if (g[i].size() == 1){
s = i;
}
}
dfs(s,-1);
for (i=0;i<v.size();++i){
if (i < a)index[i] = 1;
else if (i < a+b)index[i] = 2;
else index[i]=3;
}
for (i=0;i<n;++i){
res.pb(index[i]);
}
return res;
}