Submission #8152

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
81522014-09-01 09:20:03paulsohnHexagon travel (kriii1_H)C++98
0 / 1
0 ms32768 KiB
#include <stdio.h>
enum{red_green, red_blue, green_blue, green_red, blue_red, blue_green};
int L, R, M, movement[4001][2001][6] = { 0 }; //movement[L+R][M][color_forward]
int fact(int x){
if (x == 0) return 1;
return x*fact(x - 1);
}
int main(){
int comb;
scanf("%d %d %d", &L, &R, &M);
movement[0][0][4] = 1;
for (int m = 0; m <= M; ++m){
for (int t = 0; t <= L + R; ++t){
for (int i = 0; i < 3; ++i){
if (movement[t][m][2 * i] >= 1000000007)
movement[t][m][2*i] %= 1000000007;
if (movement[t][m][2 * i+1] >= 1000000007)
movement[t][m][2*i+1] %= 1000000007;
if (t < L + R){
movement[t + 1][m][2 * i] += movement[t][m][2 * i + 1];
movement[t + 1][m][2 * i + 1] += movement[t][m][2 * i];
}
if (m < M){
movement[t][m + 1][2 * i] += movement[t][m][(2 * i + 4) % 6];
movement[t][m + 1][2 * i + 1] += movement[t][m][(2 * i + 3) % 6];
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...