start by the hash made of the hand on the WA but with the nominal shot for a long while there is no difference may be generated data is too water ... #include<iostream>#include<cstdio>#include<cstring>#defineMAXN 100010#defineMoD 10000007#definell Long Longusing namespaceStd;ll ha;intn,a[maxn][6],Base, j[7];BOOLF[mod+Ten];intinit () {intx=0, f=1;Chars=GetChar (); while(s<'0'|| S>'9'){if(s=='-') f=-1; s=GetChar ();} while(s>='0'&&s<='9') {x=x*Ten+s-'0'; s=GetChar ();} returnx*F;}intMain () { while(cin>>N) {memset (F,0,sizeof(f));intfalg=0; for(intI=1; i<=n;i++) for(intj=0; j<=5; j + +) A[i][j]=init (); j[1]= -; j[2]=107; j[3]=117; j[4]=1007; j[5]=10007; j[6]=100007; Base=a[1][0]; for(intI=1; i<=n;i++) { intc[ -],num=0; for(intj=0; j<=5; j + +) if(a[i][j]==Base) {ha=0; for(intK=j,r=1; r<=6; k++,r++) ha+=a[i][k%6]*J[r]; if(ha<0) ha=-ha;ha%=mod;c[++num]=ha; Ha=0; for(intK=j,r=1; r<=6K--, r++) ha+=a[i][6)%6]*J[r]; if(ha<0) ha=-ha;ha%=mod;c[++num]=ha; } for(intj=1; j<=num;j++) if(f[c[j]]==1) {printf ("Twin Snowflakes found.\n"); Falg=1; Break; } if(FALG) Break; for(intj=1; j<=num;j++) f[c[j]]=1; } if(FALG)Continue; printf ("No. Snowflakes is alike.\n"); } return 0;}
/*See what many people say in their blogs about what they can do without judging the structure .... There's something wrong with the data ... To say that the minimum representation of positive solution is a method to solve the isomorphism problem but did not understand the violence to seek (do not know why than the nominal algorithm to run faster) and then each snowflake with the smallest representation of the last sort to find adjacent there is no same*/#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cstdlib>#defineMAXN 100010using namespacestd;intn,a[maxn][6],falg,c[6];intinit () {intx=0, f=1;Chars=GetChar (); while(s<'0'|| S>'9'){if(s=='-') f=-1; s=GetChar ();} while(s>='0'&&s<='9') {x=x*Ten+s-'0'; s=GetChar ();} returnx*F;}intMYCMP (int*a,int*b) { for(intI=0;i<6; i++) if(B[i]<a[i])return 1; Else if(A[i]<b[i])return 0; return 0;}intcmpConst void*a,Const void*b) { int*x = (int*) A, *y = (int*) b; for(intI=0;i<6; i++) { if(* (X+i) <* (y+i))return-1; if(* (X+i) >* (y+i))return 1; } falg=1; return 0;}voidInsert (intk) { intti[6]; for(intI=0;i<6; i++) Ti[i]=C[i]; for(ints=0;s<6; s++) { intt[6]; for(intI=s,r=0;r<6; r++,i++) t[r]=c[i%6]; if(mycmp (ti,t)) for(intI=0;i<6; i++) ti[i]=T[i]; for(intI=s,r=0;r<6; r++,i--) T[r]=c[(i+6)%6]; if(mycmp (ti,t)) for(intI=0;i<6; i++) ti[i]=T[i]; } memcpy (A[k],ti,sizeof(int)*6);}intMain () { while(cin>>N) {falg=0; for(intI=0; i<n;i++) { for(intj=0;j<6; j + +) c[j]=init (); Insert (i); } qsort (A,n,sizeof(a[0]), CMP); if(falg==1) printf ("Twin Snowflakes found.\n"); Elseprintf"No. Snowflakes is alike.\n"); } return 0;}
POJ 3349 (minimum notation)