Submission #49323

#TimeUsernameProblemLanguageResultExecution timeMemory
49323okaybody10Tents (JOI18_tents)C++11
100 / 100
439 ms59340 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9+7; ll dp[3005][3005]; ll d(int h,int w) { if(h<0 || w<0) return 0; if(h==0 || w==0) return 1; if(dp[h][w]) return dp[h][w]; ll ret=0; ret+=d(h-1,w); ret%=MOD; ret+=4*w*d(h-1,w-1); ret%=MOD; ret+=w*(w-1)/2*d(h-1,w-2); ret%=MOD; ret+=(h-1)*w*d(h-2,w-1); ret%=MOD; return dp[h][w]=ret%MOD; } int main(){ int h,w; scanf("%d %d",&w,&h); d(h,w); printf("%lld",(dp[h][w]+MOD-1)%MOD); return 0; }

Compilation message (stderr)

tents.cpp: In function 'int main()':
tents.cpp:19:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int h,w; scanf("%d %d",&w,&h);
              ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...