제출 #1223792

#제출 시각아이디문제언어결과실행 시간메모리
1223792emptypringlescanTents (JOI18_tents)C++17
0 / 100
31 ms71436 KiB
#include <bits/stdc++.h> using namespace std; long long memo[3005][3005]; const long long mod=1000000007; long long dp(int x, int y){ if(memo[x][y]!=-1) return memo[x][y]; if(x==0||y==0) return 1; long long ret=dp(x-1,y); ret+=dp(x-1,y-1)*y*4ll%mod; ret%=mod; ret+=dp(x-2,y-1)*y%mod*(x-1)%mod; ret%=mod; ret+=y*(y-1)/2%mod*dp(x-1,y-2)%mod; return memo[x][y]=ret; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); memset(memo,-1,sizeof(memo)); int a,b; cin >> a >> b; cout << dp(a,b)-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...