Submission #1077667

#TimeUsernameProblemLanguageResultExecution timeMemory
1077667Martincho506Tents (JOI18_tents)C++17
0 / 100
1 ms860 KiB
#include<bits/stdc++.h> using namespace std; int mod = 1000000007, vis[301][301], dp[301][301]; int f(int i, int j) { if(i == 0 || j == 0) return 1; if(i < 0 || j < 0) return 0; if(vis[i][j]) return dp[i][j]; vis[i][j] = true; dp[i][j] = ((f(i-1, j)+4*j*f(i-1, j-1))%mod+(f(i-1, j-2)*j*(j-1)/2)%mod+(f(i-2, j-1)*j*(i-1))%mod)%mod; return dp[i][j]; } int main() { int n, m; cin>>n>>m; cout<<f(n, m)-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...