Submission #99725

#TimeUsernameProblemLanguageResultExecution timeMemory
99725junukwon7Tents (JOI18_tents)C++98
100 / 100
142 ms70904 KiB
//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)

tents.cpp: In function 'int main()':
tents.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &W, &H);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...