Submission #388623

#TimeUsernameProblemLanguageResultExecution timeMemory
388623denkendoemeerTents (JOI18_tents)C++14
100 / 100
255 ms31940 KiB
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; #define ll long long int dp[3005][3005]; ll calc(int a,int b) { if (a<=0 || b<=0) return 1; if (dp[a][b]) return dp[a][b]; ll ans=0; ans+=calc(a-1,b); ans+=(b*(a-1))*calc(a-2,b-1); ans+=((b*(b-1))/2)*calc(a-1,b-2); ans+=calc(a-1,b-1)*b*4; ans=ans%mod; dp[a][b]=ans; return ans; } int main() { //freopen(".in","r",stdin); //freopen(".out","w",stdout); int n,m; scanf("%d%d",&n,&m); printf("%lld\n",calc(n,m)-1); return 0; }

Compilation message (stderr)

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