Submission #3106

# Submission time Handle Problem Language Result Execution time Memory
3106 2013-08-25T08:12:15 Z ainta Hexagon travel (kriii1_H) C++
1 / 1
772 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<=i&&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 Correct 12 ms 32688 KB Output is correct
7 Correct 0 ms 32688 KB Output is correct
8 Correct 0 ms 32688 KB Output is correct
9 Correct 36 ms 32688 KB Output is correct
10 Correct 772 ms 32688 KB Output is correct
11 Correct 456 ms 32688 KB Output is correct
12 Correct 240 ms 32688 KB Output is correct
13 Correct 84 ms 32688 KB Output is correct
14 Correct 240 ms 32688 KB Output is correct
15 Correct 232 ms 32688 KB Output is correct
16 Correct 80 ms 32688 KB Output is correct
17 Correct 196 ms 32688 KB Output is correct
18 Correct 248 ms 32688 KB Output is correct
19 Correct 100 ms 32688 KB Output is correct
20 Correct 144 ms 32688 KB Output is correct