Submission #1109751

# Submission time Handle Problem Language Result Execution time Memory
1109751 2024-11-07T13:46:47 Z Warinchai Tents (JOI18_tents) C++14
0 / 100
80 ms 39760 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[300][300][300];
int md=2e9+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<<"\n";
}
//ill finish later
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 5 ms 3408 KB Output is correct
5 Incorrect 80 ms 39760 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 5 ms 3408 KB Output is correct
5 Incorrect 80 ms 39760 KB Output isn't correct
6 Halted 0 ms 0 KB -