Submission #99725

# Submission time Handle Problem Language Result Execution time Memory
99725 2019-03-06T10:05:57 Z junukwon7 Tents (JOI18_tents) C++
100 / 100
142 ms 70904 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];
            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

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 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 3 ms 1152 KB Output is correct
5 Correct 3 ms 796 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 896 KB Output is correct
8 Correct 3 ms 1408 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 4 ms 1792 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 5 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 3 ms 1152 KB Output is correct
5 Correct 3 ms 796 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 896 KB Output is correct
8 Correct 3 ms 1408 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 4 ms 1792 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 5 ms 2304 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 9 ms 9728 KB Output is correct
15 Correct 89 ms 55176 KB Output is correct
16 Correct 9 ms 4096 KB Output is correct
17 Correct 27 ms 12928 KB Output is correct
18 Correct 29 ms 17144 KB Output is correct
19 Correct 109 ms 62968 KB Output is correct
20 Correct 84 ms 50908 KB Output is correct
21 Correct 66 ms 33784 KB Output is correct
22 Correct 55 ms 35448 KB Output is correct
23 Correct 38 ms 27000 KB Output is correct
24 Correct 132 ms 70904 KB Output is correct
25 Correct 106 ms 61148 KB Output is correct
26 Correct 126 ms 66596 KB Output is correct
27 Correct 142 ms 69000 KB Output is correct