# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
494849 |
2021-12-16T20:13:39 Z |
NekoRolly |
Tents (JOI18_tents) |
C++17 |
|
96 ms |
70856 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e3+4;
const int M = 2e2+4;
const int inf = 1e9;
const int mod = 1e9+7;
int n,m;
ll dp[N][N];
ll c2(ll k){
return (k*k - k)/2 %mod;
}
ll pro(ll a,ll b){
return (a*b)%mod;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
for (int i=0; i<=n; i++) dp[i][0] = 1;
for (int i=0; i<=m; i++) 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] + 4 * j * dp[i-1][j-1];
if (i >= 2) dp[i][j] += pro(i-1, j) * dp[i-2][j-1];
if (j >= 2) dp[i][j] += c2(j) * dp[i-1][j-2];
dp[i][j] %= mod;
}
cout << (dp[n][m]+mod-1)%mod << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
452 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
836 KB |
Output is correct |
8 |
Correct |
1 ms |
1360 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
1732 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
2 ms |
2240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
452 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
836 KB |
Output is correct |
8 |
Correct |
1 ms |
1360 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
1732 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
2 ms |
2240 KB |
Output is correct |
13 |
Correct |
1 ms |
320 KB |
Output is correct |
14 |
Correct |
4 ms |
9644 KB |
Output is correct |
15 |
Correct |
56 ms |
55120 KB |
Output is correct |
16 |
Correct |
4 ms |
4048 KB |
Output is correct |
17 |
Correct |
14 ms |
12768 KB |
Output is correct |
18 |
Correct |
17 ms |
16968 KB |
Output is correct |
19 |
Correct |
66 ms |
62812 KB |
Output is correct |
20 |
Correct |
47 ms |
50888 KB |
Output is correct |
21 |
Correct |
32 ms |
33680 KB |
Output is correct |
22 |
Correct |
32 ms |
35404 KB |
Output is correct |
23 |
Correct |
21 ms |
27088 KB |
Output is correct |
24 |
Correct |
72 ms |
70856 KB |
Output is correct |
25 |
Correct |
64 ms |
61188 KB |
Output is correct |
26 |
Correct |
96 ms |
66540 KB |
Output is correct |
27 |
Correct |
72 ms |
68976 KB |
Output is correct |