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;
#define sz(x) (int)x.size()
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define lowb(x) (x&(-x))
#define ALL(_x) _x.begin(),_x.end()
#define pii pair<int,int>
#define f first
#define s second
#define SORT_UNIQUE(x) sort(ALL(x)),x.erase(unique(ALL(x)),x.end())
const int maxn=1e5+5;
#define ll long long
vector<int> v[maxn];
bool vis[maxn];
vector<int> top;
void dfs(int u){
vis[u]=1;
for(int x:v[u]){
if(!vis[x]) dfs(x);
}
top.pb(u);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<int> ans(n,0);
REP(i,sz(p)){
v[p[i]].pb(q[i]),v[q[i]].pb(p[i]);
}
dfs(0);
REP(i,a) ans[top[i]]=1;
REP(i,b) ans[top[i+a]]=2;
REP(i,c) ans[top[i+a+b]]=3;
return ans;
}
# | 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... |