【UVA10601】Cubes(Burnside)(组合数学)

    xiaoxiao2023-10-18  181

    传送门


    解析:

    很显然我们需要运用 B u r n s i d e Burnside Burnside来计算而不是 P o l y a Polya Polya,因为这个显然并不是那么简单的染色问题。

    那么考虑怎么求出所有不动点个数。

    考虑如下几种置换:

    不动,1种,12个循环,每个长度为1。以体对角线为轴旋转,4条对角线,每条2种转法,4个循环,每个循环长度为3以对面中心连线为轴旋转,3条线,每条有3种转法,但是有区别 其中两种,转 9 0 ∘ 90^\circ 90和转 27 0 ∘ 270^\circ 270,是一样的,3个循环,每个长度为 4 4 4。 最后一种,转 18 0 ∘ 180^\circ 180,6个循环,每个长度为 2 2 2以对棱中点连线为轴旋转,6条线,每条只有转 18 0 ∘ 180^\circ 180一种方法。其中两条边不会动,剩下构成5个循环,每个长度为2。

    显然以上24种置换是构成群的。

    发现什么没有?所有置换里面,要么就是独立点,要么就是长度全部相等的循环。

    那么我们预处理组合数,直接用组合数算不动点的个数。

    一共24种置换,直接除就行了。


    代码:

    #include<bits/stdc++.h> #define ll long long #define re register #define gc getchar #define cs const namespace IO{ inline char get_char(){ static cs int Rlen=1<<20|1; static char buf[Rlen],*p1,*p2; return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,Rlen,stdin),p1==p2)?EOF:*p1++; } template<typename T> inline T get(){ re char c; while(!isdigit(c=gc()));re T num=c^48; while(isdigit(c=gc()))num=(num+(num<<2)<<1)+(c^48); return num; } inline int getint(){return get<int>();} } using namespace IO; using std::cout; using std::cerr; int a[6],b[6]; ll c[13][13]; inline ll solve(int k){//令所有循环长度为k时候的方案数 int n=0;ll res=1; for(int re i=0;i<6;++i) if(b[i]%k)return 0; else n+=(b[i]/=k); for(int re i=0;i<6;++i) res*=c[n][b[i]],n-=b[i]; return res; } int T; signed main(){ for(int re i=0;i<=12;++i){ c[i][0]=c[i][i]=1; for(int re j=1;j<i;++j)c[i][j]=c[i-1][j]+c[i-1][j-1]; } T=getint(); while(T--){ memset(a,0,sizeof a); ++a[getint()-1],++a[getint()-1],++a[getint()-1],++a[getint()-1]; ++a[getint()-1],++a[getint()-1],++a[getint()-1],++a[getint()-1]; ++a[getint()-1],++a[getint()-1],++a[getint()-1],++a[getint()-1]; ll ans=0; memcpy(b,a,sizeof a); ans+=solve(1); memcpy(b,a,sizeof a); ans+=8*solve(3); memcpy(b,a,sizeof a); ans+=6*solve(4); memcpy(b,a,sizeof a); ans+=3*solve(2); for(int re i=0;i<6;++i) for(int re j=0;j<6;++j){ memcpy(b,a,sizeof a); if(!b[i]--||!b[j]--)continue; ans+=6*solve(2); } cout<<ans/24<<"\n"; } return 0; }
    最新回复(0)