#include <bits/stdc++.h>
#include "split.h"
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define RREP1(i, n) for (int i = (n); i >= 1; i--)
#define REP1(i, n) FOR(i, 1, n+1)
#define pii pair<int, int>
#define ppi pair<pii, int>
#define pip pair<int, pii>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define endl '\n'
#define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
const ll maxn = 1e5+5;
const ll inf = 1e9;
const ll mod = 998244353;
ll pw(ll x, ll p, ll m){
ll ret = 1;
while(p > 0){
if (p & 1){
ret *= x;
ret %= m;
}
x *= x;
x %= m;
p >>= 1;
}
return ret;
}
ll inv(ll x, ll m){
return pw(x, m-2, m);
}
int n, m;
vector<int> g[maxn];
vector<int> col(maxn);
int a, b, c;
int sm = 0;
void dfs(int x){
sm++;
if (sm <= b) col[x] = 2;
else if (sm > b+1) col[x] = 3;
else col[x] = 1;
for (auto y:g[x]){
if (col[y] != -1) continue;
dfs(y);
}
}
vector<int> find_split (int N, int A, int B, int C, vector<int> v1, vector<int> v2){
n = N;
m = SZ(v1);
a = A; b = B; c = C;
REP(i, m){
g[v1[i]].pb(v2[i]);
g[v2[i]].pb(v1[i]);
}
fill(ALL(col), -1);
dfs(1);
vector<int> ret;
REP(i, n) ret.pb(col[i]);
return ret;
}
/*
signed main(){
cout<<count_rectangles({{4, 8, 7, 5, 6}, {7, 4, 10, 3, 5}, {9, 7, 20, 14, 2}})<<endl;
}
*/
/*
4 4
1 2
2 3
3 1
1 4
*/
# | 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... |