Submission #139203

#TimeUsernameProblemLanguageResultExecution timeMemory
139203zoooma13Tents (JOI18_tents)C++14
48 / 100
466 ms108288 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1e9+7; int GM(long long num){ return num%mod; } int n ,m ,dp[302][302][302]; int solve(int p ,int l ,int t){ if(t<0 || l<0) return 0; if(p == n) return !l; int&ret = dp[p][t][l]; if(~ret) return ret; ret = solve(p+1 ,l ,t); ///nothing ret = GM(ret + 1LL*l*solve(p+1 ,l-1 ,t)); ///adding rest of vertical tent ret = GM(ret + 1LL*t*solve(p+1 ,l+1 ,t-1)); ///adding vertical tents ret = GM(ret + 4LL*t*solve(p+1 ,l ,t-1)); ///adding a solo tent ret = GM(ret + 1LL*t*(t-1)/2*solve(p+1 ,l ,t-2)); ///adding horizontal tents //cout << p << " " << l << " " << t << " = " << ret << endl; return ret; } int main() { scanf("%d%d",&n,&m); memset(dp ,-1 ,sizeof dp); printf("%d\n",solve(0,0,m)-1); }

Compilation message (stderr)

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