# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1108872 |
2024-11-05T13:45:36 Z |
Warinchai |
Tents (JOI18_tents) |
C++14 |
|
2 ms |
3408 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Incorrect |
2 ms |
3408 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Incorrect |
2 ms |
3408 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |