제출 #535161

#제출 시각아이디문제언어결과실행 시간메모리
535161LoboTents (JOI18_tents)C++17
100 / 100
113 ms71400 KiB
#include<bits/stdc++.h> using namespace std; const long long inf = (long long) 1e18 + 10; const int inf1 = (int) 1e9 + 10; #define int long long #define dbl long double #define endl '\n' #define sc second #define fr first #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() #define maxn 3030 int dp[maxn][maxn]; int mod = 1e9+7; void solve() { int n, m; cin >> n >> m; int ans = 0; dp[n][m] = 1; for(int i = n; i >= 0; i--) { for(int j = m; j >= 0; j--) { dp[i][j]+= dp[i+1][j]; dp[i][j]+= dp[i+1][j+1]*(j+1)*4; dp[i][j]+= dp[i+1][j+2]*(j+2)*(j+1)/2; dp[i][j]+= dp[i+2][j+1]*(j+1)*(i+1); dp[i][j]%= mod; // cout << i << " " << j << " " << dp[i][j] << endl; } } for(int j = m; j >= 0; j--) ans+= dp[0][j]; cout << (ans-1+mod)%mod << endl; } int32_t main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("in.in", "r", stdin); //freopen("out.out", "w", stdout); int tt = 1; // cin >> tt; while(tt--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...