답안 #887800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887800 2023-12-15T08:42:29 Z vjudge1 Tents (JOI18_tents) C++14
100 / 100
52 ms 70732 KB
// Parsa Jokar 2023 https://github.com/phictus/ioi

#pragma GCC optimize("Ofast")

#include <iostream>
#include <cstdint>

using namespace std;

constexpr int64_t maxn = 3000, mod = 1000000007;
int64_t n, m, dp[maxn + 1][maxn + 1];

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n >> m;

    for (int64_t i = 0; i <= n; i++)
        dp[i][0] = 1;
    for (int64_t j = 0; j <= m; j++)
        dp[0][j] = 1;
    for (int64_t i = 1; i <= n; i++)
        dp[i][1] = 1 + 4 * i + (i * (i - 1)) / 2;
    for (int64_t j = 1; j <= m; j++)
        dp[1][j] = 1 + 4 * j + (j * (j - 1)) / 2;

    for (int64_t i = 2; i <= n; i++)
    {
        for (int64_t j = 2; j <= m; j++)
        {
            dp[i][j] = dp[i][j - 1] + 4 * i * dp[i - 1][j - 1] + i * (j - 1) * dp[i - 1][j - 2] + (i * (i - 1) / 2) * dp[i - 2][j - 1];
            dp[i][j] %= mod;
        }
    }

    cout << dp[n][m] - 1 << '\n';

    return (0 ^ 0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 512 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 2 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 512 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6488 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 2 ms 8540 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 20 ms 55860 KB Output is correct
15 Correct 38 ms 66140 KB Output is correct
16 Correct 3 ms 6492 KB Output is correct
17 Correct 8 ms 17240 KB Output is correct
18 Correct 11 ms 29428 KB Output is correct
19 Correct 41 ms 70232 KB Output is correct
20 Correct 32 ms 57948 KB Output is correct
21 Correct 22 ms 39516 KB Output is correct
22 Correct 21 ms 51804 KB Output is correct
23 Correct 18 ms 70384 KB Output is correct
24 Correct 52 ms 70732 KB Output is correct
25 Correct 40 ms 62044 KB Output is correct
26 Correct 47 ms 68332 KB Output is correct
27 Correct 48 ms 70236 KB Output is correct