# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3832 | wookayin | Hexagon travel (kriii1_H) | C++98 | 0 ms | 32768 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>
const int mod = 1000000007;
int p[4023][4023];
int d[2005][4006][6];
int cm[6];
int main()
{
int l,r,m;
scanf("%d%d%d",&l,&r,&m);
for(int i = 0; i <= l+r; i++){
p[i][0] = p[i][i] = 1;
for(int j = 1; j < i; j++) {
p[i][j] = (p[i-1][j] + p[i-1][j-1])%mod;
}
}
cm[0] = 2;
cm[1] = 5;
cm[2] = 4;
cm[3] = 1;
cm[4] = 0;
cm[5] = 3;
d[0][0][4] = 1;
for(int i = 0; i <= l+r; i++) {
for(int j = 0; j <= m; j++) {
for(int k = 0; k < 6;k ++){
d[i+1][j][k^1] = (d[i+1][j][k^1] + d[i][j][k])%mod;
d[i][j+1][cm[k]] = (d[i][j+1][cm[k]] + d[i][j][k])%mod;
}
}
}
for(int j = 0;j < 3;j++)
{
long long ans = 0;
for(int i = 0; i <2; i++){
ans += d[l+r][m][i+j*2];
}
ans %= mod;
ans *= p[l+r][l];
ans %= mod;
printf("%d\n", (int)ans);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |