Submission #1108872

#TimeUsernameProblemLanguageResultExecution timeMemory
1108872WarinchaiTents (JOI18_tents)C++14
0 / 100
2 ms3408 KiB
#include<bits/stdc++.h> using namespace std; int dp[3005][3005]; int sum[3005][3005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int h,w;cin>>h>>w; dp[0][w]=1; for(int i=0;i<=h;i++){ for(int j=0;j<=w;j++){ dp[i+1][j]+=dp[i][j]; if(j>0)dp[i+1][j-1]+=dp[i][j]*j*4; if(j>1)dp[i+1][j-2]+=dp[i][j]*j*(j-1)/2; dp[i+1][j]+=sum[i][j]; sum[i+1][j]+=sum[i][j]; if(j>0)sum[i+1][j-1]+=(sum[i][j]*j)+dp[i][j]*j; // sum[i+1][j]+=sum[i][j]-sum[i][j];//wrong // if(j>0)sum[i+1][j-1]+=sum[i][j]*3*j; if(j>1)sum[i+1][j-2]+=sum[i][j]*j*(j-1)/2; } } int ans=0; for(int i=0;i<=w;i++){ ans+=dp[h][i]; } cout<<ans-1<<"\n"; } //ill finish later
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...