# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
330325 |
2020-11-24T19:24:03 Z |
Sho10 |
Tents (JOI18_tents) |
C++14 |
|
78 ms |
70892 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,m,dp[3005][3005];
int32_t main(){
CODE_START;
cin>>n>>m;
for(ll i=0;i<=n;i++)
{
for(ll j=0;j<=m;j++)
dp[i][j]=1;
}
for(ll i=1;i<=n;i++)
{
for(ll j=1;j<=m;j++)
{
dp[i][j]=dp[i-1][j];
if(j>=2){
dp[i][j]+=dp[i-1][j-2]*j*(j-1)/2;
}
if(i>=2){
dp[i][j]+=dp[i-2][j-1]*j*(i-1);
}
dp[i][j]+=4*j*dp[i-1][j-1];
dp[i][j]%=mod;
}
}
cout<<dp[n][m]-1<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
1132 KB |
Output is correct |
5 |
Correct |
1 ms |
748 KB |
Output is correct |
6 |
Correct |
1 ms |
1388 KB |
Output is correct |
7 |
Correct |
1 ms |
876 KB |
Output is correct |
8 |
Correct |
2 ms |
1516 KB |
Output is correct |
9 |
Correct |
1 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
1772 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
2 ms |
2284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
1132 KB |
Output is correct |
5 |
Correct |
1 ms |
748 KB |
Output is correct |
6 |
Correct |
1 ms |
1388 KB |
Output is correct |
7 |
Correct |
1 ms |
876 KB |
Output is correct |
8 |
Correct |
2 ms |
1516 KB |
Output is correct |
9 |
Correct |
1 ms |
876 KB |
Output is correct |
10 |
Correct |
1 ms |
1772 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
2 ms |
2284 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
6 ms |
9708 KB |
Output is correct |
15 |
Correct |
61 ms |
55276 KB |
Output is correct |
16 |
Correct |
5 ms |
4076 KB |
Output is correct |
17 |
Correct |
12 ms |
12908 KB |
Output is correct |
18 |
Correct |
16 ms |
17132 KB |
Output is correct |
19 |
Correct |
57 ms |
63084 KB |
Output is correct |
20 |
Correct |
55 ms |
51000 KB |
Output is correct |
21 |
Correct |
37 ms |
33900 KB |
Output is correct |
22 |
Correct |
34 ms |
35564 KB |
Output is correct |
23 |
Correct |
22 ms |
27116 KB |
Output is correct |
24 |
Correct |
78 ms |
70892 KB |
Output is correct |
25 |
Correct |
58 ms |
61292 KB |
Output is correct |
26 |
Correct |
69 ms |
66816 KB |
Output is correct |
27 |
Correct |
70 ms |
69100 KB |
Output is correct |