#include<stdio.h>
#define md 1000000007
typedef long long ll;
int l, r, m;
ll cmb[2222][2222], dy[4444][2222][6], t;
// loop type : 0=RGB, 1=RBG, 2=GBR, 3=GRB, 4=BRG, 5=BGR
int main(){
int i, j, k, x;
scanf("%d%d%d", &l, &r, &m);
for(i=0; i<=l; i++){
for(j=0; j<=r; j++){
if(!i || !j)cmb[i][j]=1;
else{
cmb[i][j]=cmb[i-1][j]+cmb[i][j-1];
if(cmb[i][j]>=md)cmb[i][j]-=md;
}
}
}
dy[l+r][m][4]=1;
for(i=l+r; i>=0; i--){
for(j=m; j>=0; j--){
for(k=0; k<6; k++){
if(i>0){
dy[i-1][j][k^1]+=dy[i][j][k];
if(dy[i-1][j][k^1]>=md)dy[i-1][j][k^1]-=md;
}
if(j>0){
if(k%2)x=(k+4)%6;
else x=(k+2)%6;
dy[i][j-1][x]+=dy[i][j][k];
if(dy[i][j-1][x]>=md)dy[i][j-1][x]-=md;
}
}
}
}
for(i=0; i<3; i++)printf("%lld\n", cmb[l][r]*(dy[0][0][2*i]+dy[0][0][2*i+1])%md);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
0 ms |
32768 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |