Submission #197500

#TimeUsernameProblemLanguageResultExecution timeMemory
197500handlenameTents (JOI18_tents)C++17
100 / 100
326 ms32028 KiB
#include <bits/stdc++.h> using namespace std; int h,w; int memo[3001][3001]; long long dp(int a,int b){ if (a<=0 || b<=0) return 1; if (memo[a][b]!=0) return memo[a][b]; long long ans=0; ans+=dp(a-1,b); ans+=4*b*dp(a-1,b-1); ans+=((b*(b-1))/2)*dp(a-1,b-2); ans+=(b*(a-1))*dp(a-2,b-1); ans%=1000000007; return memo[a][b]=ans; } int main() { cin>>h>>w; cout<<dp(h,w)-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...