Submission #45875

#TimeUsernameProblemLanguageResultExecution timeMemory
458753zpTents (JOI18_tents)C++14
100 / 100
207 ms71268 KiB
#include<bits/stdc++.h> using namespace std; long long dp[3009][3009]; long long mod = 1e9+7; main(){ long long H,W; cin >> H>> W; for (long long i = 1; i<= H; i++){ dp[i][1]= i*(i-1)/2+4*i+1; dp[i][0]= 1; } for (long long j=1; j<=W; j++){ dp[1][j] =j*(j-1)/2+4*j+1; dp[0][j] = 1; } for(long long i =2; i<= H; i++){ for (long long j = 2; j<= W; j++){ dp[i][j]= (dp[i-1][j]+(4*j*dp[i-1][j-1])+j*(i-1)*dp[i-2][j-1]+j*(j-1)/2*dp[i-1][j-2])%mod; } } cout<<(dp[H][W] + mod -1 )%mod<<endl; }

Compilation message (stderr)

tents.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...