悬赏关注*1,不用改全过,帮忙过5-6个点即可
查看原帖
悬赏关注*1,不用改全过,帮忙过5-6个点即可
823725
EZAIJ楼主2024/4/10 13:39

现在是只过了一个点。。

#include<bits/stdc++.h>
using namespace std;

const int mod=1e9+7; 
typedef long long LL;

int reject[7][7],n,m,f[2][7];
 
int oppo(int x){
	if(x<=3) return x+3;
	else return x-3;
} 
 
int main(){
	cin>>n>>m;
	int a,b;
	while(m--){
		cin>>a>>b;
		reject[a][oppo(b)]=1,reject[b][oppo(a)]=1;
	}
	for(int i=1;i<=6;i++)
		f[1][i]=4;
	for(int t=2;t<=n;t++)
		for(int i=1;i<=6;i++)
			for(int j=1;j<=6;j++)
				if(!reject[i][j]){
					f[t%2][i]=((LL)4*f[(t%2)^1][j]+f[t%2][i])%mod;
				}
	int ans=0;
	for(int i=1;i<=6;i++)
		ans=(ans+f[n%2][i])%mod;
	cout<<ans;
	return 0;
} 
2024/4/10 13:39
加载中...