#include "dengklek.h"
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
using namespace std;
vector<int> edge1[10001];
int bt1[10001], t1;
bool vis1[10001], ck1[10001];
int lf;
void dfs1(int a, int pr) {
int ct = 0, v = -1;
for(int k=0;k<edge1[a].size();k++) {
if(ck1[edge1[a][k]] && edge1[a][k] != pr) dfs1(edge1[a][k], a);
if(ck1[edge1[a][k]]) {
ct++;
v = edge1[a][k];
}
}
if(pr != -1 && ct == 1 && v == pr) lf = a;
}
void dfs(int a, int pr) {
vis1[a] = 1;
if(t1 == 60) {
dfs1(pr, -1);
ck1[lf] = 0;
ck1[a] = 1;
bt1[a] = bt1[lf];
for(int k=0;k<edge1[a].size();k++) {
if(!vis1[edge1[a][k]]) dfs(edge1[a][k], a);
}
ck1[a] = 0;
ck1[lf] = 1;
} else {
bt1[a] = t1++;
ck1[a] = 1;
for(int k=0;k<edge1[a].size();k++) {
if(!vis1[edge1[a][k]]) dfs(edge1[a][k], a);
}
ck1[a] = 0;
}
}
void giveHint(int N, int M, vector<int> A, vector<int> B, ll X, int T) {
t1 = 0;
for(int k=0;k<N;k++) {
edge1[k].clear();
bt1[k] = -1;
ck1[k] = 0;
vis1[k] = 0;
}
for(int i=0;i<A.size();i++) {
edge1[A[i]].push_back(B[i]);
edge1[B[i]].push_back(A[i]);
}
dfs(0, -1);
for(int i=0;i<N;i++) {
// cout<<i<<" "<<bt[i]<<" "<<(X&(1 << bt[i]))<<endl;
if(X&(1ll << bt1[i]%60)) writeMessage(i, 1);
else writeMessage(i, 0);
}
}
#include "chanek.h"
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
using namespace std;
vector<int> edge[10001], ch[10001];
int bt[10001], t;
bool viss[10001], ck[10001];
int lf1;
void dfs12(int a, int pr) {
int ct = 0, v = -1;
for(int k=0;k<edge[a].size();k++) {
if(!ck[edge[a][k]]) continue;
if(edge[a][k] != pr) dfs12(edge[a][k], a);
ct++;
v = edge[a][k];
}
if(pr != -1 && ct == 1 && v == pr) lf1 = a;
}
void dfs2(int a, int pr) {
viss[a] = 1;
if(t == 60) {
dfs12(pr, -1);
ck[lf1] = 0;
ck[a] = 1;
bt[a] = bt[lf1];
for(int k=0;k<edge[a].size();k++) {
if(!viss[edge[a][k]]) dfs2(edge[a][k], a);
}
ck[a] = 0;
ck[lf1] = 1;
} else {
bt[a] = t++;
ck[a] = 1;
for(int k=0;k<edge[a].size();k++) {
if(!viss[edge[a][k]]) dfs2(edge[a][k], a);
}
ck[a] = 0;
}
}
int fnd[101], vis[100001];
int ctt = 60, x = 0;
void dfss(int a, int bf) {
for(int k=0;k<edge[a].size();k++) {
if(fnd[bt[edge[a][k]]] == -1) {
fnd[bt[edge[a][k]]] = move(edge[a][k]);
dfss(edge[a][k], a);
}
}
if(bf != -1) fnd[bt[bf]] = move(bf);
}
long long findNumber(int N, int M, vector<int> A, vector<int> B, int P, int V, int T) {
t = 0;
for(int k=0;k<N;k++) {
edge[k].clear();
bt[k] = -1;
viss[k] = 0;
ck[k] = 0;
}
for(int i=0;i<A.size();i++) {
edge[A[i]].push_back(B[i]);
edge[B[i]].push_back(A[i]);
}
dfs2(0, -1);
for(int i=0;i<60;i++) fnd[i] = -1;
fnd[bt[P]] = V;
dfss(P, -1);
ll ans = 0ll;
for(ll i=0;i<60;i++) {
// cout<<i<<" "<<fnd[i]<<endl;
if(fnd[i] == 1) ans += (1ll << i);
}
return ans;
}
Compilation message
Joi.cpp:1:10: fatal error: dengklek.h: No such file or directory
1 | #include "dengklek.h"
| ^~~~~~~~~~~~
compilation terminated.
Ioi.cpp:1:10: fatal error: chanek.h: No such file or directory
1 | #include "chanek.h"
| ^~~~~~~~~~
compilation terminated.