似乎没定义 fir 数组,但在一个函数中用了,本地居然没报错
  • 板块学术版
  • 楼主wangif424
  • 当前回复10
  • 已保存回复11
  • 发布时间2023/11/5 17:56
  • 上次更新2023/11/6 15:28:53
查看原帖
似乎没定义 fir 数组,但在一个函数中用了,本地居然没报错
521283
wangif424楼主2023/11/5 17:56
#include <bits/stdc++.h>
#define R(x) x = read()
#define ENDL push('\n');
#define SPACE push(' ');
#define int long long
using namespace std;
char pbuf[1<<20], *pp=pbuf;
inline void push(const char &c) {
	if(pp - pbuf == 1<<20)fwrite(pbuf, 1, 1<<20, stdout),pp = pbuf;
	*pp++ = c;
}
class io {public:~io() {fwrite(pbuf, 1, pp - pbuf, stdout);}} _;
inline void write(int x) {
	if (x<0)x=-x,push('-');
	int sta[35],top=0;
	do {
		sta[top++]=x%10,x/=10;
	} while (x);
	while(top)push(sta[--top]^'0');
}
#ifndef LOCAL
	char buf[1<<23],*p1=buf,*p2=buf;
	#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#endif
inline int read() {
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
    return x*f;
}
struct edge{
	int to,nxt;
};
constexpr int mod=20061113,c=114514;
int g(int x){
	return ((x^3)+x*x%mod*x%mod+(x<<7)%mod)%mod;
}
struct tree{
	edge v[114];
	int num;
	int l=1,r1=1,r2,siz[114],miz[114];
	int hsh1,hsh2;
	tree(){
		l=0;
		r1=0;
		miz[0]=LLONG_MAX;
	}
	void getroot(int u,int fa){
		siz[u]=1;
		for(int i=fir[u];i;i=v[i].nxt){
			if(fa==v[i].to)continue;
			getroot(v[i].to,u);
			siz[u]+=siz[v[i].to];
			miz[u]=max(miz[u],siz[v[i].to]);
		}
		miz[u]=max(miz[u],num-siz[u]);
		if(miz[u]<miz[r1]){
			r1=u;
			l=1;
		}else if(miz[u]==miz[r1]){
			r2=u;
			l=2;
		}
	}
	int dfs(int u,int fa){
		int res=c;
		for(int i=fir[u];i;i=v[i].nxt){
			if(v[i].to==fa)continue;
			res=(res+g()dfs(v[i].to,u))%mod;
		}
		return res;
	}
	void gethash(){
		hsh1=dfs(r1,0);
		if(l==2)hsh2=dfs(r2,0);
	}
	bool operator==(tree b){
		return l==b.l?(hsh1==b.hsh1||hsh1==b.hsh2):0;
	}
}t[114];
signed main(){

    return 0;
}



2023/11/5 17:56
加载中...