답안 #1079667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079667 2024-08-28T20:53:46 Z DeathIsAwe Tents (JOI18_tents) C++17
100 / 100
115 ms 70936 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1000000007;
ll dp[3001][3001];


int main() {
    int h,w; cin >> h >> w;
    for (int i=0;i<3001;i++) {
        for (int j=0;j<3001;j++) {
            dp[i][j] = 0;
        }
    }
    for (int i=0;i<3001;i++) {
        dp[i][0] = 1; dp[0][i] = 1;
    }


    for (int i=1;i<h+1;i++) {
        for (int j=1;j<w+1;j++) {
            dp[i][j] += dp[i-1][j];
            dp[i][j] += (4 * j) * dp[i-1][j-1]; dp[i][j] %= mod;
            if (i > 1) {
                dp[i][j] += (i - 1)  * j * dp[i-2][j-1]; dp[i][j] %= mod;
            }
            if (j > 1) {
                dp[i][j] += j * (j - 1) * dp[i-1][j-2] / 2; dp[i][j] %= mod;
            }
            //cout << dp[i][j] << ' ';
        }
        //cout << '\n';
    }
    cout << dp[h][w] - 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 70736 KB Output is correct
2 Correct 40 ms 70736 KB Output is correct
3 Correct 32 ms 70744 KB Output is correct
4 Correct 33 ms 70740 KB Output is correct
5 Correct 32 ms 70736 KB Output is correct
6 Correct 33 ms 70836 KB Output is correct
7 Correct 37 ms 70736 KB Output is correct
8 Correct 32 ms 70740 KB Output is correct
9 Correct 32 ms 70744 KB Output is correct
10 Correct 24 ms 70804 KB Output is correct
11 Correct 38 ms 70740 KB Output is correct
12 Correct 43 ms 70740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 70736 KB Output is correct
2 Correct 40 ms 70736 KB Output is correct
3 Correct 32 ms 70744 KB Output is correct
4 Correct 33 ms 70740 KB Output is correct
5 Correct 32 ms 70736 KB Output is correct
6 Correct 33 ms 70836 KB Output is correct
7 Correct 37 ms 70736 KB Output is correct
8 Correct 32 ms 70740 KB Output is correct
9 Correct 32 ms 70744 KB Output is correct
10 Correct 24 ms 70804 KB Output is correct
11 Correct 38 ms 70740 KB Output is correct
12 Correct 43 ms 70740 KB Output is correct
13 Correct 33 ms 70744 KB Output is correct
14 Correct 32 ms 70740 KB Output is correct
15 Correct 73 ms 70736 KB Output is correct
16 Correct 34 ms 70736 KB Output is correct
17 Correct 40 ms 70740 KB Output is correct
18 Correct 48 ms 70736 KB Output is correct
19 Correct 73 ms 70708 KB Output is correct
20 Correct 73 ms 70736 KB Output is correct
21 Correct 61 ms 70912 KB Output is correct
22 Correct 58 ms 70736 KB Output is correct
23 Correct 48 ms 70936 KB Output is correct
24 Correct 115 ms 70884 KB Output is correct
25 Correct 70 ms 70744 KB Output is correct
26 Correct 87 ms 70908 KB Output is correct
27 Correct 100 ms 70740 KB Output is correct