Submission #3106

#TimeUsernameProblemLanguageResultExecution timeMemory
3106aintaHexagon travel (kriii1_H)C++98
1 / 1
772 ms32688 KiB
#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 timeMemoryGrader output
Fetching results...