# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49057 |
2018-05-21T14:46:29 Z |
Namnamseo |
Tents (JOI18_tents) |
C++17 |
|
668 ms |
63996 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[3010][3010];
const ll mod = 1'000'000'007;
ll f(ll w, ll h){
if(!w || !h) return 1;
if(w<0 || h<0) return 0;
if(dp[w][h]) return dp[w][h];
ll ret = 0;
ret += f(w, h-1);
(ret += w * 4 * f(w-1, h-1) % mod) %= mod;
(ret += w*(w-1)/2 % mod * f(w-2, h-1) % mod) %= mod;
(ret += w * (h-1) % mod * f(w-1, h-2) % mod) %= mod;
return dp[w][h]=ret;
}
int main()
{
int n, m; cin >> n >> m;
cout << (f(n, m) + mod - 1) % mod << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
540 KB |
Output is correct |
4 |
Correct |
2 ms |
672 KB |
Output is correct |
5 |
Correct |
4 ms |
980 KB |
Output is correct |
6 |
Correct |
4 ms |
1348 KB |
Output is correct |
7 |
Correct |
4 ms |
1348 KB |
Output is correct |
8 |
Correct |
4 ms |
1348 KB |
Output is correct |
9 |
Correct |
3 ms |
1348 KB |
Output is correct |
10 |
Correct |
5 ms |
1920 KB |
Output is correct |
11 |
Correct |
3 ms |
1920 KB |
Output is correct |
12 |
Correct |
8 ms |
2456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
540 KB |
Output is correct |
4 |
Correct |
2 ms |
672 KB |
Output is correct |
5 |
Correct |
4 ms |
980 KB |
Output is correct |
6 |
Correct |
4 ms |
1348 KB |
Output is correct |
7 |
Correct |
4 ms |
1348 KB |
Output is correct |
8 |
Correct |
4 ms |
1348 KB |
Output is correct |
9 |
Correct |
3 ms |
1348 KB |
Output is correct |
10 |
Correct |
5 ms |
1920 KB |
Output is correct |
11 |
Correct |
3 ms |
1920 KB |
Output is correct |
12 |
Correct |
8 ms |
2456 KB |
Output is correct |
13 |
Correct |
3 ms |
2456 KB |
Output is correct |
14 |
Correct |
2 ms |
2456 KB |
Output is correct |
15 |
Correct |
376 ms |
40844 KB |
Output is correct |
16 |
Correct |
23 ms |
40844 KB |
Output is correct |
17 |
Correct |
76 ms |
40844 KB |
Output is correct |
18 |
Correct |
94 ms |
40844 KB |
Output is correct |
19 |
Correct |
421 ms |
47084 KB |
Output is correct |
20 |
Correct |
350 ms |
47084 KB |
Output is correct |
21 |
Correct |
223 ms |
47084 KB |
Output is correct |
22 |
Correct |
225 ms |
47084 KB |
Output is correct |
23 |
Correct |
33 ms |
47084 KB |
Output is correct |
24 |
Correct |
664 ms |
63996 KB |
Output is correct |
25 |
Correct |
463 ms |
63996 KB |
Output is correct |
26 |
Correct |
481 ms |
63996 KB |
Output is correct |
27 |
Correct |
668 ms |
63996 KB |
Output is correct |