Submission #994846

# Submission time Handle Problem Language Result Execution time Memory
994846 2024-06-08T07:28:39 Z matere Tents (JOI18_tents) C++14
100 / 100
164 ms 70992 KB
#include<bits/stdc++.h>
using namespace std;
long long h,w,dp[3005][3005],MOD=1000000007;
int main(){
    cin>>h>>w;
    for(int i=0;i<=max(h,w);i++) dp[0][i]=dp[i][0]=1;
    for(long long i=1;i<=h;i++){
        for(long long j=1;j<=w;j++){
            dp[i][j]+=dp[i][j-1];
            dp[i][j]%=MOD;
            dp[i][j]+=i*4*dp[i-1][j-1];
            dp[i][j]%=MOD;
            dp[i][j]+=i*(j-1)*dp[i-1][j-2];
            dp[i][j]%=MOD;
            dp[i][j]+=i*(i-1)/2*dp[i-2][j-1];
            dp[i][j]%=MOD;
        }
    }
    cout<<dp[h][w]-1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 6492 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 6492 KB Output is correct
6 Correct 1 ms 6516 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 0 ms 4444 KB Output is correct
10 Correct 2 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 3 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 6492 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 6492 KB Output is correct
6 Correct 1 ms 6516 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 0 ms 4444 KB Output is correct
10 Correct 2 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 3 ms 8540 KB Output is correct
13 Correct 4 ms 43356 KB Output is correct
14 Correct 5 ms 55644 KB Output is correct
15 Correct 99 ms 66244 KB Output is correct
16 Correct 10 ms 37468 KB Output is correct
17 Correct 25 ms 43612 KB Output is correct
18 Correct 30 ms 33276 KB Output is correct
19 Correct 119 ms 70232 KB Output is correct
20 Correct 93 ms 57944 KB Output is correct
21 Correct 59 ms 49752 KB Output is correct
22 Correct 62 ms 51804 KB Output is correct
23 Correct 37 ms 70484 KB Output is correct
24 Correct 164 ms 70992 KB Output is correct
25 Correct 117 ms 62040 KB Output is correct
26 Correct 142 ms 68188 KB Output is correct
27 Correct 149 ms 70232 KB Output is correct