Submission #3105

# Submission time Handle Problem Language Result Execution time Memory
3105 2013-08-25T07:57:28 Z ainta Hexagon travel (kriii1_H) C++
0 / 1
12 ms 32688 KB
#include<stdio.h>
int D[2][2010][6],n,m,Mod=1000000007,C[4011][2011],x;
long long R,G,B;
int main()
{
	int a,b,i,j,k,t;
	scanf("%d%d%d",&a,&b,&m);
	n=a+b;
	for(i=0;i<=n;i++){
		C[i][0]=1;
		for(j=1;j<=a;j++){
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;
		}
	}
	for(i=0;i<=n;i++){
		x=!x;
		for(j=0;j<=m;j++)for(k=0;k<6;k++)D[x][j][k]=0;
		if(!i)D[x][0][0]=1;
		for(j=0;j<=m;j++){
			for(k=0;k<6;k++){
				t=(7-k)%6;
				if(i)D[x][j][k]=(D[x][j][k]+D[!x][j][t])%Mod;
				t=(k+4)%6;
				if(j)D[x][j][k]=(D[x][j][k]+D[x][j-1][t])%Mod;
			}
		}
	}
	R=D[x][m][2]+D[x][m][5];
	G=D[x][m][3]+D[x][m][4];
	B=D[x][m][0]+D[x][m][1];
	printf("%lld\n%lld\n%lld\n",R*C[n][a]%Mod,G*C[n][a]%Mod,B*C[n][a]%Mod);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 32688 KB Output is correct
2 Correct 0 ms 32688 KB Output is correct
3 Correct 0 ms 32688 KB Output is correct
4 Correct 0 ms 32688 KB Output is correct
5 Correct 0 ms 32688 KB Output is correct
6 Incorrect 12 ms 32688 KB Output isn't correct
7 Halted 0 ms 0 KB -