#include<bits/stdc++.h>
using namespace std;
const int N = 3005;
int dp[3005][3005];
const int mod = 1e9 + 7;
int main(){
int h, w; cin >> h >> w;
int ans = 0;
for(int i = 1; i <= h; i++){
for(int j = 1; j <= w; j++){
ans=0;
ans += dp[i-1][j];
if(j > 1){
ans += (j * (j-1))/2 * (dp[i-1][j-2]+1);
}
ans += (dp[i-1][j-1]+1) * j * 4;
if(i > 1){
ans += (dp[i-2][j - 1] + 1) * (i-1) * (j);
}
ans %= mod;
dp[i][j]=ans;
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
1116 KB |
Output is correct |
5 |
Incorrect |
0 ms |
604 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
1116 KB |
Output is correct |
5 |
Incorrect |
0 ms |
604 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |