#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0)
#define mp make_pair
#define xx first
#define yy second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(x) x.begin(),x.end()
#define ff(i,a,b) for (int i = a; i < b; i++)
#define fff(i,a,b) for (int i = a; i <= b; i++)
#define bff(i,a,b) for (int i = b-1; i >= a; i--)
#define bfff(i,a,b) for (int i = b; i >= a; i--)
using namespace std;
long double typedef ld;
unsigned int typedef ui;
long long int typedef li;
pair<int,int> typedef pii;
pair<li,li> typedef pli;
pair<ld,ld> typedef pld;
vector<vector<int>> typedef graph;
unsigned long long int typedef ull;
//const int mod = 998244353;
const int mod = 1000000007;
//Note to self: Check for overflow
#include "Ioi.h"
namespace ioi
{
int up[10004];
int Up(int x)
{
if (up[x]<0) return x;
return up[x]=Up(up[x]);
}
void build(int n)
{
ff(i,0,n) up[i]=-1;
}
bool dsu(int a, int b)
{
a=Up(a),b=Up(b);
if (a==b) return false;
if (up[a]<up[b]) swap(a,b);
up[b]+=up[a],up[a]=b;
return true;
}
bool broj[60];
graph g(10004);
int boja[10004];
int tb=0;
vector<int> tura;
void dfs(int p, int q)
{
tura.pb(p);
boja[p]=tb++;
if (tb==60) tb=0;
for (auto it : g[p]) if (it!=q)
{
dfs(it,p);
tura.pb(p);
}
}
bool uklj[69];
int kolko=0;
li ans=0;
li solve(int n, int m, int A[], int B[], int P, int V)
{
build(n);
ff(i,0,m) if (dsu(A[i],B[i])) g[A[i]].pb(B[i]),g[B[i]].pb(A[i]);
dfs(0,-1);
uklj[boja[P]]=1,kolko++;
if (V) ans|=(1ll<<boja[P]);
int id=0;
while (tura[id]!=P) id++;
while (true)
{
++id; if (id==(int)tura.size()) id=1; int p=tura[id];
int sta=Move(p);
if (!uklj[boja[p]])
{
uklj[boja[p]]=1,kolko++;
if (sta) ans|=(1ll<<boja[p]);
if (kolko==60) break;
}
}
return ans;
}
}
using namespace ioi;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
return solve(N,M,A,B,P,V);
}
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0)
#define mp make_pair
#define xx first
#define yy second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(x) x.begin(),x.end()
#define ff(i,a,b) for (int i = a; i < b; i++)
#define fff(i,a,b) for (int i = a; i <= b; i++)
#define bff(i,a,b) for (int i = b-1; i >= a; i--)
#define bfff(i,a,b) for (int i = b; i >= a; i--)
using namespace std;
long double typedef ld;
unsigned int typedef ui;
long long int typedef li;
pair<int,int> typedef pii;
pair<li,li> typedef pli;
pair<ld,ld> typedef pld;
vector<vector<int>> typedef graph;
unsigned long long int typedef ull;
//const int mod = 998244353;
const int mod = 1000000007;
//Note to self: Check for overflow
#include "Ioi.h"
namespace ioi
{
int up[10004];
int Up(int x)
{
if (up[x]<0) return x;
return up[x]=Up(up[x]);
}
void build(int n)
{
ff(i,0,n) up[i]=-1;
}
bool dsu(int a, int b)
{
a=Up(a),b=Up(b);
if (a==b) return false;
if (up[a]<up[b]) swap(a,b);
up[b]+=up[a],up[a]=b;
return true;
}
bool broj[60];
graph g(10004);
int boja[10004];
int tb=0;
vector<int> tura;
void dfs(int p, int q)
{
tura.pb(p);
boja[p]=tb++;
if (tb==60) tb=0;
for (auto it : g[p]) if (it!=q)
{
dfs(it,p);
tura.pb(p);
}
}
bool uklj[69];
int kolko=0;
li ans=0;
li solve(int n, int m, int A[], int B[], int P, int V)
{
build(n);
ff(i,0,m) if (dsu(A[i],B[i])) g[A[i]].pb(B[i]),g[B[i]].pb(A[i]);
dfs(0,-1);
uklj[boja[P]]=1,kolko++;
if (V) ans|=(1ll<<boja[P]);
int id=0;
while (tura[id]!=P) id++;
while (true)
{
++id; if (id==(int)tura.size()) id=1; int p=tura[id];
int sta=Move(p);
if (!uklj[boja[p]])
{
uklj[boja[p]]=1,kolko++;
if (sta) ans|=(1ll<<boja[p]);
if (kolko==60) break;
}
}
return ans;
}
}
using namespace ioi;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
return solve(N,M,A,B,P,V);
}
Compilation message
Joi.cpp: In function 'li ioi::solve(int, int, int*, int*, int, int)':
Joi.cpp:105:21: error: 'Move' was not declared in this scope
105 | int sta=Move(p);
| ^~~~