# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
331679 |
2020-11-29T13:46:58 Z |
Blagojce |
Tents (JOI18_tents) |
C++11 |
|
1 ms |
384 KB |
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define rfr(i, n, m) for(int i = (n); i >= (m); i --)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int i_inf = 1e9;
const ll inf = 2e18;
const ll mod = 1e9+7;
const ld eps = 1e-13;
const ld pi = 3.14159265359;
const int mxn = 5e5;
mt19937 _rand(time(NULL));
clock_t z;
int main(){
int n, m;
cin >> n >> m;
int dp[n+1][m+1];
memset(dp, 0, sizeof(dp));
fr(i, 0, n+1) dp[i][0] = 1;
fr(i, 0, m+1) dp[0][i] = 1;
fr(i, 1, n+1){
fr(j, 1, m+1){
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] += j*dp[i-1][j-1]*4;
dp[i][j] %= mod;
}
}
int ans = (dp[n][m]-1+mod)%mod;
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |