# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3105 | ainta | Hexagon travel (kriii1_H) | C++98 | 12 ms | 32688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |