# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1033997 |
2024-07-25T08:31:14 Z |
vjudge1 |
Tents (JOI18_tents) |
C++14 |
|
121 ms |
70908 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n,m;
cin >> n >> m;
const int mod=1e9+7;
int DP[n+1][m+1];
for(int j=0;j<=m;j++){
DP[0][j]=1;
}
for(int i=1;i<=n;i++){
for(int j=0;j<=m;j++){
DP[i][j]=0;
if(i>1&&j>0){
DP[i][j]+=(DP[i-2][j-1]*((j*(i-1))%mod));
DP[i][j]%=mod;
}
if(j>1){
DP[i][j]=(DP[i][j]+((DP[i-1][j-2]*((j*(j-1)/2)%mod))%mod));
DP[i][j]%=mod;
}
if(j>0){
DP[i][j]=(DP[i][j]+((4*DP[i-1][j-1]*j)%mod));
DP[i][j]%=mod;
}
DP[i][j]+=DP[i-1][j];
DP[i][j]%=mod;
}
}
cout << (DP[n][m]+mod-1)%mod;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
1116 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
82 ms |
44124 KB |
Output is correct |
16 |
Correct |
5 ms |
3160 KB |
Output is correct |
17 |
Correct |
18 ms |
10196 KB |
Output is correct |
18 |
Correct |
23 ms |
12380 KB |
Output is correct |
19 |
Correct |
97 ms |
51440 KB |
Output is correct |
20 |
Correct |
74 ms |
41208 KB |
Output is correct |
21 |
Correct |
50 ms |
27228 KB |
Output is correct |
22 |
Correct |
45 ms |
26728 KB |
Output is correct |
23 |
Correct |
27 ms |
15108 KB |
Output is correct |
24 |
Correct |
121 ms |
70908 KB |
Output is correct |
25 |
Correct |
90 ms |
52568 KB |
Output is correct |
26 |
Correct |
103 ms |
60240 KB |
Output is correct |
27 |
Correct |
117 ms |
67924 KB |
Output is correct |