Submission #483628

#TimeUsernameProblemLanguageResultExecution timeMemory
483628ymmTents (JOI18_tents)C++17
100 / 100
92 ms71408 KiB
/// /// You fell for it, fool! /// Thunder Cross Split Attack! /// #include <bits/stdc++.h> #define Loop(x,l,r) for(ll x = ll(l); x < ll(r); ++x) typedef long long ll; using namespace std; const int mod = 1e9+7; const int N = 3010; ll dp[N][N]; int n, m; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; Loop(i,0,N) dp[0][i] = dp[i][0] = 1; Loop(x,1,N) Loop(y,1,N) { dp[x][y] = dp[x-1][y]; dp[x][y] += 4*y*dp[x-1][y-1] % mod; if(y>1) dp[x][y] += y*(y-1)/2*dp[x-1][y-2] % mod; if(x>1) dp[x][y] += y*(x-1)*dp[x-2][y-1] % mod; dp[x][y] %= mod; } cout << (dp[n][m]+mod-1)%mod << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...