# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521234 |
2022-02-01T09:15:34 Z |
Jasiekstrz |
Tents (JOI18_tents) |
C++17 |
|
70 ms |
71004 KB |
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N=3e3;
const int MOD=1e9+7;
long long dp[N+10][N+10];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=0;i<=max(n,m);i++)
dp[i][0]=dp[0][i]=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
dp[i][j]+=dp[i-1][j];
dp[i][j]+=4*j*dp[i-1][j-1];
if(j>=2)
dp[i][j]+=((j*(j-1))/2)*dp[i-1][j-2];
if(i>=2)
dp[i][j]+=j*(i-1)*dp[i-2][j-1];
dp[i][j]%=MOD;
}
}
cout<<(dp[n][m]-1+MOD)%MOD<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
972 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
1100 KB |
Output is correct |
5 |
Correct |
1 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1344 KB |
Output is correct |
8 |
Correct |
1 ms |
1356 KB |
Output is correct |
9 |
Correct |
1 ms |
716 KB |
Output is correct |
10 |
Correct |
1 ms |
1736 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
3 ms |
2124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
972 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
1100 KB |
Output is correct |
5 |
Correct |
1 ms |
1356 KB |
Output is correct |
6 |
Correct |
1 ms |
1356 KB |
Output is correct |
7 |
Correct |
1 ms |
1344 KB |
Output is correct |
8 |
Correct |
1 ms |
1356 KB |
Output is correct |
9 |
Correct |
1 ms |
716 KB |
Output is correct |
10 |
Correct |
1 ms |
1736 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
3 ms |
2124 KB |
Output is correct |
13 |
Correct |
3 ms |
7748 KB |
Output is correct |
14 |
Correct |
4 ms |
9676 KB |
Output is correct |
15 |
Correct |
51 ms |
55180 KB |
Output is correct |
16 |
Correct |
7 ms |
9420 KB |
Output is correct |
17 |
Correct |
14 ms |
17292 KB |
Output is correct |
18 |
Correct |
15 ms |
17764 KB |
Output is correct |
19 |
Correct |
57 ms |
62940 KB |
Output is correct |
20 |
Correct |
46 ms |
50856 KB |
Output is correct |
21 |
Correct |
30 ms |
35452 KB |
Output is correct |
22 |
Correct |
31 ms |
35396 KB |
Output is correct |
23 |
Correct |
19 ms |
26988 KB |
Output is correct |
24 |
Correct |
70 ms |
71004 KB |
Output is correct |
25 |
Correct |
58 ms |
61272 KB |
Output is correct |
26 |
Correct |
60 ms |
66628 KB |
Output is correct |
27 |
Correct |
66 ms |
69204 KB |
Output is correct |