Submission #99724

# Submission time Handle Problem Language Result Execution time Memory
99724 2019-03-06T09:58:46 Z junukwon7 Tents (JOI18_tents) C++
0 / 100
5 ms 512 KB
//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];
            arr[w][h] += (arr[w - 1][h - 2] * (h * (h - 1) / 2)) % Con;
            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

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 time Memory Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -