#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
mt19937 rnd(26);
struct strik{
static const int _N=1e4+100;
static const int _M=5001;
static const int _B=447;
static const int mod=998244353;
static const ll INF=1e18;
vector<int>g[_N];
bool mark[_N];
int pos[_N];
void fart(int x){
mark[x]=1;
// shuffle(g[x].begin(),g[x].end(),rnd);
for(auto i:g[x]){
if(!mark[i]){
pos[i]=(pos[x]+1)%60;
fart(i);
}
}
}
}st;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for(int i=0;i<M;i++){
st.g[A[i]].push_back(B[i]);
st.g[B[i]].push_back(A[i]);
}
st.fart(0);
for(int i=0;i<N;i++){
ll cur=st.pos[i];
ll bt=(X>>cur)&1ll;
MessageBoard(i,bt);
}
}
#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int _N=1e4+100;
const int _M=5001;
const int _B=447;
const int mod=998244353;
mt19937 rng(26);
const ll INF=1e18;
int cnt[60];
vector<int>g[_N];
bool mark[_N];
bool needtostop(){
for(int j=0;j<60;j++){
if(cnt[j]==-1){
return 0;
}
}
return 1;
}
bool mark2[_N];
int par[_N];
void fart(int x){
mark2[x]=1;
// shuffle(g[x].begin(),g[x].end(),rng);
for(auto i:g[x]){
if(!mark2[i]){
par[i]=(par[x]+1)%60;
fart(i);
}
}
}
void dfs(int x){
mark[x]=1;
if(needtostop())return;
for(auto i:g[x]){
if(!mark[i]){
cnt[par[i]]=Move(i);
dfs(i);
if(needtostop())return;
cnt[par[x]]=Move(x);
}
}
}
long long Ioi(int n, int m, int a[], int b[], int pos, int V, int T) {
for(int i=0;i<m;i++){
g[a[i]].push_back(b[i]);
g[b[i]].push_back(a[i]);
}
fart(0);
for(int i=0;i<60;i++){
cnt[i]=-1;
}
cnt[par[pos]]=V;
dfs(pos);
ll ans=0;
for(ll i=0;i<60;i++){
if(cnt[i]){
ans+=(1ll<<i);
}
}
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... |