답안 #1109753

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109753 2024-11-07T13:49:28 Z Warinchai Tents (JOI18_tents) C++14
48 / 100
484 ms 219932 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[305][305][305];
int md=1e9+7;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int h,w;cin>>h>>w;
    dp[0][w][0]=1;
    for(int i=0;i<=h;i++){
        for(int j=0;j<=w;j++){
            for(int k=0;k<=w;k++){
                dp[i+1][j-1][k]=(dp[i+1][j-1][k]+3*j*dp[i][j][k])%md;
                dp[i+1][j-1][k+1]=(dp[i+1][j-1][k+1]+dp[i][j][k]*j)%md;
                dp[i+1][j][k-1]=(dp[i+1][j][k-1]+dp[i][j][k]*k)%md;
                dp[i+1][j-2][k]=(dp[i+1][j-2][k]+j*(j-1)/2*dp[i][j][k])%md;
                dp[i+1][j][k]=(dp[i+1][j][k]+dp[i][j][k])%md;
            }
        }
    }
    int ans=0;
    for(int i=0;i<=w;i++)for(int j=0;j<=w;j++)ans=(ans+dp[h][i][j])%md;
    cout<<(ans-1)%md<<"\n";
}
//ill finish later
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 2 ms 2896 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 4 ms 3408 KB Output is correct
5 Correct 74 ms 40268 KB Output is correct
6 Correct 58 ms 51788 KB Output is correct
7 Correct 88 ms 49992 KB Output is correct
8 Correct 37 ms 37740 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 135 ms 100596 KB Output is correct
11 Correct 17 ms 8784 KB Output is correct
12 Correct 484 ms 219932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 2 ms 2896 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 4 ms 3408 KB Output is correct
5 Correct 74 ms 40268 KB Output is correct
6 Correct 58 ms 51788 KB Output is correct
7 Correct 88 ms 49992 KB Output is correct
8 Correct 37 ms 37740 KB Output is correct
9 Correct 3 ms 2896 KB Output is correct
10 Correct 135 ms 100596 KB Output is correct
11 Correct 17 ms 8784 KB Output is correct
12 Correct 484 ms 219932 KB Output is correct
13 Incorrect 96 ms 5960 KB Output isn't correct
14 Halted 0 ms 0 KB -