# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
82882 |
2018-11-02T13:34:18 Z |
Bodo171 |
Tents (JOI18_tents) |
C++14 |
|
169 ms |
71448 KB |
#include <iostream>
#include <fstream>
using namespace std;
const long long mod=1000*1000*1000+7;
long long dp[3005][3005];
int h,w;
long long i,j;
int main()
{
// freopen("data.in","r",stdin);
cin>>h>>w;
for(i=0;i<=max(h,w);i++)
dp[i][0]=dp[0][i]=1;
for(i=1;i<=h;i++)
{
for(j=1;j<=w;j++)
{
dp[i][j]+=(1LL*dp[i-1][j])%mod;
if(j>=2)dp[i][j]+=(1LL*dp[i-1][j-2]*j*(j-1)/2)%mod;
if(i>=2)dp[i][j]+=(dp[i-2][j-1]*1LL*(i-1)*j)%mod;
dp[i][j]+=(dp[i-1][j-1]*4*j)%mod;
dp[i][j]%=mod;
}
}
cout<<(dp[h][w]-1+mod)%mod;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
1152 KB |
Output is correct |
3 |
Correct |
2 ms |
1152 KB |
Output is correct |
4 |
Correct |
3 ms |
1268 KB |
Output is correct |
5 |
Correct |
3 ms |
1664 KB |
Output is correct |
6 |
Correct |
3 ms |
1664 KB |
Output is correct |
7 |
Correct |
3 ms |
1724 KB |
Output is correct |
8 |
Correct |
3 ms |
1724 KB |
Output is correct |
9 |
Correct |
2 ms |
1724 KB |
Output is correct |
10 |
Correct |
4 ms |
2180 KB |
Output is correct |
11 |
Correct |
3 ms |
2180 KB |
Output is correct |
12 |
Correct |
5 ms |
2584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
1152 KB |
Output is correct |
3 |
Correct |
2 ms |
1152 KB |
Output is correct |
4 |
Correct |
3 ms |
1268 KB |
Output is correct |
5 |
Correct |
3 ms |
1664 KB |
Output is correct |
6 |
Correct |
3 ms |
1664 KB |
Output is correct |
7 |
Correct |
3 ms |
1724 KB |
Output is correct |
8 |
Correct |
3 ms |
1724 KB |
Output is correct |
9 |
Correct |
2 ms |
1724 KB |
Output is correct |
10 |
Correct |
4 ms |
2180 KB |
Output is correct |
11 |
Correct |
3 ms |
2180 KB |
Output is correct |
12 |
Correct |
5 ms |
2584 KB |
Output is correct |
13 |
Correct |
8 ms |
8088 KB |
Output is correct |
14 |
Correct |
9 ms |
10252 KB |
Output is correct |
15 |
Correct |
119 ms |
55648 KB |
Output is correct |
16 |
Correct |
14 ms |
55648 KB |
Output is correct |
17 |
Correct |
34 ms |
55648 KB |
Output is correct |
18 |
Correct |
37 ms |
55648 KB |
Output is correct |
19 |
Correct |
138 ms |
63644 KB |
Output is correct |
20 |
Correct |
111 ms |
63644 KB |
Output is correct |
21 |
Correct |
84 ms |
63644 KB |
Output is correct |
22 |
Correct |
76 ms |
63644 KB |
Output is correct |
23 |
Correct |
49 ms |
63644 KB |
Output is correct |
24 |
Correct |
168 ms |
71448 KB |
Output is correct |
25 |
Correct |
133 ms |
71448 KB |
Output is correct |
26 |
Correct |
151 ms |
71448 KB |
Output is correct |
27 |
Correct |
169 ms |
71448 KB |
Output is correct |