# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
781389 |
2023-07-13T05:07:25 Z |
이성호(#10012) |
Tents (JOI18_tents) |
C++17 |
|
47 ms |
70912 KB |
#include <iostream>
#define int long long
using namespace std;
const int mod = 1e9 + 7;
long long dp[3005][3005];
signed main()
{
dp[1][1] = 5;
for (int i = 2; i <= 3000; i++) {
dp[i][1] = dp[1][i] = i * (i-1) / 2 + i * 4 + 1;
}
for (int i = 1; i <= 3000; i++) {
dp[i][0] = dp[0][i] = 1;
}
for (int i = 2; i <= 3000; i++) {
for (int j = 2; j <= 3000; j++) {
dp[i][j] = (j * (j-1) / 2 * dp[i-1][j-2] + j * (i-1) * dp[i-2][j-1] + j * 4 * dp[i-1][j-1] + dp[i-1][j]) % mod;
}
}
int h, w; cin >> h >> w;
cout << dp[h][w] - 1 << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
70804 KB |
Output is correct |
2 |
Correct |
44 ms |
70768 KB |
Output is correct |
3 |
Correct |
45 ms |
70792 KB |
Output is correct |
4 |
Correct |
43 ms |
70780 KB |
Output is correct |
5 |
Correct |
43 ms |
70836 KB |
Output is correct |
6 |
Correct |
45 ms |
70828 KB |
Output is correct |
7 |
Correct |
43 ms |
70768 KB |
Output is correct |
8 |
Correct |
44 ms |
70824 KB |
Output is correct |
9 |
Correct |
44 ms |
70764 KB |
Output is correct |
10 |
Correct |
44 ms |
70860 KB |
Output is correct |
11 |
Correct |
44 ms |
70796 KB |
Output is correct |
12 |
Correct |
44 ms |
70860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
70804 KB |
Output is correct |
2 |
Correct |
44 ms |
70768 KB |
Output is correct |
3 |
Correct |
45 ms |
70792 KB |
Output is correct |
4 |
Correct |
43 ms |
70780 KB |
Output is correct |
5 |
Correct |
43 ms |
70836 KB |
Output is correct |
6 |
Correct |
45 ms |
70828 KB |
Output is correct |
7 |
Correct |
43 ms |
70768 KB |
Output is correct |
8 |
Correct |
44 ms |
70824 KB |
Output is correct |
9 |
Correct |
44 ms |
70764 KB |
Output is correct |
10 |
Correct |
44 ms |
70860 KB |
Output is correct |
11 |
Correct |
44 ms |
70796 KB |
Output is correct |
12 |
Correct |
44 ms |
70860 KB |
Output is correct |
13 |
Correct |
47 ms |
70912 KB |
Output is correct |
14 |
Correct |
44 ms |
70792 KB |
Output is correct |
15 |
Correct |
43 ms |
70784 KB |
Output is correct |
16 |
Correct |
44 ms |
70760 KB |
Output is correct |
17 |
Correct |
44 ms |
70840 KB |
Output is correct |
18 |
Correct |
47 ms |
70828 KB |
Output is correct |
19 |
Correct |
45 ms |
70780 KB |
Output is correct |
20 |
Correct |
43 ms |
70860 KB |
Output is correct |
21 |
Correct |
45 ms |
70768 KB |
Output is correct |
22 |
Correct |
45 ms |
70776 KB |
Output is correct |
23 |
Correct |
44 ms |
70832 KB |
Output is correct |
24 |
Correct |
45 ms |
70860 KB |
Output is correct |
25 |
Correct |
44 ms |
70804 KB |
Output is correct |
26 |
Correct |
44 ms |
70796 KB |
Output is correct |
27 |
Correct |
44 ms |
70760 KB |
Output is correct |