# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
342310 |
2021-01-01T20:20:24 Z |
bigDuck |
Tents (JOI18_tents) |
C++14 |
|
1 ms |
364 KB |
#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll
int t, n, m, k, a[300010], q, l, r;
int mod=((int)1e9)+7;
int dp[3010][3010];
int32_t main(){
INIT
cin>>n>>m;
dp[0][0]=1;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if( (i==1) && (j==1) ){
dp[i][j]=5;
}
else{
dp[i][j]=max(1ll, dp[i-1][j]+dp[i][j-1])+max(1ll, dp[i-1][j-1])*4;
}
if(i>=2){
dp[i][j]+=max(dp[i-2][j-1], 1ll)*(i-1);
}
if(j>=2){
dp[i][j]+=max(dp[i-1][j-2], 1ll)*(j-1);
}
dp[i][j]%=mod;
//cout<<dp[i][j]<<" ";
}
//cout<<"\n";
}
cout<<(dp[n][m]-1);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |