Submission #44119

#TimeUsernameProblemLanguageResultExecution timeMemory
44119khsoo01Tents (JOI18_tents)C++11
100 / 100
84 ms71168 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 3005, M = 1e9+7; ll h, w, dt[N][N]; int main() { scanf("%lld%lld",&h,&w); for(ll i=0;i<=w;i++) dt[0][i] = 1; for(ll i=1;i<=h;i++) { dt[i][0] = 1; for(ll j=1;j<=w;j++) { dt[i][j] = dt[i-1][j] + 4*j*dt[i-1][j-1]; if(i >= 2) dt[i][j] += dt[i-2][j-1]*j*(i-1); if(j >= 2) dt[i][j] += dt[i-1][j-2]*j*(j-1)/2; dt[i][j] %= M; } } printf("%lld\n",(dt[h][w]+M-1)%M); }

Compilation message (stderr)

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