# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99725 | junukwon7 | Tents (JOI18_tents) | C++98 | 142 ms | 70904 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.
//https://oj.uz/problem/view/JOI18_tents
#include <stdio.h>
#define Con 1000000007
long long int arr[3001][3001] = {0};
long long int W, H;
int main()
{
scanf("%lld %lld", &W, &H);
for(long long int w = 0; w <= W; w++)
{
arr[w][0] = 1;
}
for(long long int h = 0; h <= H; h++)
{
arr[0][h] = 1;
}
for(long long int w = 1; w <= W; w++)
{
for(long long int h = 1; h <= H; h++)
{
arr[w][h] = arr[w - 1][h];
if(h > 1) arr[w][h] += (arr[w - 1][h - 2] * (h * (h - 1) / 2)) % Con;
if(w > 1) arr[w][h] += (arr[w - 2][h - 1] * h * (w - 1)) % Con;
arr[w][h] += (arr[w - 1][h - 1] * 4 * h) % Con;
arr[w][h] %= Con;
}
}
printf("%lld", (arr[W][H] + Con - 1) % Con);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |