# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1077675 |
2024-08-27T08:33:43 Z |
Martincho506 |
Tents (JOI18_tents) |
C++17 |
|
306 ms |
117192 KB |
#include<bits/stdc++.h>
using namespace std;
long long mod = 1000000007, vis[3001][3001], dp[3001][3001];
long long f(long long i, long long j)
{
if(i == 0 || j == 0) return 1;
if(i < 0 || j < 0) return 0;
if(vis[i][j]) return dp[i][j];
vis[i][j] = true;
dp[i][j] = ((f(i-1, j)+4*j*f(i-1, j-1))%mod+(f(i-1, j-2)*j*(j-1)/2)%mod+(f(i-2, j-1)*j*(i-1))%mod)%mod;
return dp[i][j];
}
int main()
{
long long n, m;
cin>>n>>m;
cout<<f(n, m)-1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
7260 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
2 ms |
7608 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
2 ms |
7772 KB |
Output is correct |
9 |
Correct |
1 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
10076 KB |
Output is correct |
11 |
Correct |
0 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
10332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
7260 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
2 ms |
7608 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
2 ms |
7772 KB |
Output is correct |
9 |
Correct |
1 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
10076 KB |
Output is correct |
11 |
Correct |
0 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
10332 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
9 ms |
39516 KB |
Output is correct |
15 |
Correct |
209 ms |
98384 KB |
Output is correct |
16 |
Correct |
2 ms |
7768 KB |
Output is correct |
17 |
Correct |
17 ms |
23384 KB |
Output is correct |
18 |
Correct |
34 ms |
38736 KB |
Output is correct |
19 |
Correct |
191 ms |
108372 KB |
Output is correct |
20 |
Correct |
163 ms |
86868 KB |
Output is correct |
21 |
Correct |
82 ms |
55412 KB |
Output is correct |
22 |
Correct |
136 ms |
69456 KB |
Output is correct |
23 |
Correct |
69 ms |
62544 KB |
Output is correct |
24 |
Correct |
306 ms |
117192 KB |
Output is correct |
25 |
Correct |
191 ms |
98008 KB |
Output is correct |
26 |
Correct |
258 ms |
108824 KB |
Output is correct |
27 |
Correct |
295 ms |
113492 KB |
Output is correct |