Submission #869341

# Submission time Handle Problem Language Result Execution time Memory
869341 2023-11-04T05:35:53 Z sleepntsheep Tents (JOI18_tents) C++17
48 / 100
1 ms 1188 KB
#include <iostream>
#include <cassert>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>

using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using ll = long long;
#define N 305

const ll M = 1000000007;

int h, w;
ll dp[N][N];

int main()
{
    ShinLena;
    cin >> h >> w;
    for (int i = 0; i < N; ++i) dp[0][i] = dp[i][0] = 1;
    for (int i = 1; i <= h; ++i) for (int j = 1; j <= w; ++j)
    {
        (dp[i][j] += dp[i-1][j] + (4ll * j * dp[i-1][j-1] % M)) %= M;
        if (i > 1) (dp[i][j] += (1ll*(i-1)*j%M) * dp[i-2][j-1] % M) %= M;
        if (j > 1) (dp[i][j] += (1ll*j*(j-1)%M*500000004%M) * dp[i-1][j-2] % M) %= M;
    }
    cout << (dp[h][w] + M - 1) % M << endl;
    return 0;
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Incorrect 1 ms 1188 KB Output isn't correct
14 Halted 0 ms 0 KB -