# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1109771 |
2024-11-07T14:18:56 Z |
Warinchai |
Tents (JOI18_tents) |
C++14 |
|
88 ms |
70984 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[3005][3005];
int md=1e9+7;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int h,w;cin>>h>>w;
for(int i=0;i<=h;i++)dp[i][0]=1;
for(int i=0;i<=w;i++)dp[0][i]=1;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
dp[i][j]=(dp[i][j]+dp[i-1][j-1]*j*4+dp[i-1][j])%md;
if(j>1)dp[i][j]=(dp[i][j]+dp[i-1][j-2]*(j)*(j-1)/2)%md;
if(i>1)dp[i][j]=(dp[i][j]+(i-1)*j*dp[i-2][j-1])%md;
}
}
cout<<(dp[h][w]-1+md)%md<<"\n";
}
//ill finish later
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
6480 KB |
Output is correct |
9 |
Correct |
1 ms |
4432 KB |
Output is correct |
10 |
Correct |
2 ms |
8528 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
3 ms |
8720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
6480 KB |
Output is correct |
9 |
Correct |
1 ms |
4432 KB |
Output is correct |
10 |
Correct |
2 ms |
8528 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
3 ms |
8720 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
7 ms |
55888 KB |
Output is correct |
15 |
Correct |
55 ms |
66128 KB |
Output is correct |
16 |
Correct |
5 ms |
6736 KB |
Output is correct |
17 |
Correct |
15 ms |
17024 KB |
Output is correct |
18 |
Correct |
17 ms |
29264 KB |
Output is correct |
19 |
Correct |
66 ms |
70224 KB |
Output is correct |
20 |
Correct |
51 ms |
57936 KB |
Output is correct |
21 |
Correct |
34 ms |
39504 KB |
Output is correct |
22 |
Correct |
37 ms |
51792 KB |
Output is correct |
23 |
Correct |
23 ms |
70396 KB |
Output is correct |
24 |
Correct |
88 ms |
70984 KB |
Output is correct |
25 |
Correct |
65 ms |
62032 KB |
Output is correct |
26 |
Correct |
74 ms |
68176 KB |
Output is correct |
27 |
Correct |
86 ms |
70224 KB |
Output is correct |