답안 #484054

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484054 2021-11-02T02:39:51 Z SirCovidThe19th Tents (JOI18_tents) C++17
100 / 100
73 ms 70732 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m; cin >> n >> m; long long dp[n + 1][m + 1] = {};
    for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++){
        dp[i][j] += dp[i - 1][j];
        dp[i][j] += (dp[i - 1][j - 1] + 1) * j * 4;
        if (j > 1) dp[i][j] += (dp[i - 1][j - 2] + 1) * j * (j - 1) / 2; 
        if (i > 1) dp[i][j] += (dp[i - 2][j - 1] + 1) * j * (i - 1); 
        dp[i][j] %= (int)1e9 + 7;
    }
    cout<<dp[n][m]<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 972 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 45 ms 43980 KB Output is correct
16 Correct 3 ms 3020 KB Output is correct
17 Correct 10 ms 10060 KB Output is correct
18 Correct 12 ms 12360 KB Output is correct
19 Correct 56 ms 51300 KB Output is correct
20 Correct 40 ms 41036 KB Output is correct
21 Correct 31 ms 27128 KB Output is correct
22 Correct 27 ms 26768 KB Output is correct
23 Correct 15 ms 14972 KB Output is correct
24 Correct 73 ms 70732 KB Output is correct
25 Correct 51 ms 52508 KB Output is correct
26 Correct 57 ms 60176 KB Output is correct
27 Correct 67 ms 67916 KB Output is correct