# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44367 | 2018-04-01T06:12:55 Z | choikiwon | Tents (JOI18_tents) | C++17 | 429 ms | 36324 KB |
#include<bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int H, W; int cc[3010][3010]; int dp(int r, int c) { int &ret = cc[r][c]; if(ret != -1) return ret; if(!r || !c) return ret = 1; ret = 0; ret += dp(r - 1, c); ret %= mod; if(r >= 1) { ret += 1LL * 4 * c % mod * dp(r - 1, c - 1) % mod; ret %= mod; } if(r >= 2) { ret += 1LL * (r - 1) * c % mod * dp(r - 2, c - 1) % mod; ret %= mod; } if(c >= 2) { ret += 1LL * (c * (c - 1) / 2) * dp(r - 1, c - 2) % mod; ret %= mod; } return ret; } int main() { scanf("%d %d", &H, &W); memset(cc, -1, sizeof(cc)); printf("%d", dp(H, W) - 1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 35832 KB | Output is correct |
2 | Correct | 26 ms | 35832 KB | Output is correct |
3 | Correct | 26 ms | 36000 KB | Output is correct |
4 | Correct | 27 ms | 36008 KB | Output is correct |
5 | Correct | 26 ms | 36008 KB | Output is correct |
6 | Correct | 26 ms | 36008 KB | Output is correct |
7 | Correct | 27 ms | 36020 KB | Output is correct |
8 | Correct | 27 ms | 36052 KB | Output is correct |
9 | Correct | 26 ms | 36052 KB | Output is correct |
10 | Correct | 29 ms | 36068 KB | Output is correct |
11 | Correct | 26 ms | 36068 KB | Output is correct |
12 | Correct | 29 ms | 36068 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 35832 KB | Output is correct |
2 | Correct | 26 ms | 35832 KB | Output is correct |
3 | Correct | 26 ms | 36000 KB | Output is correct |
4 | Correct | 27 ms | 36008 KB | Output is correct |
5 | Correct | 26 ms | 36008 KB | Output is correct |
6 | Correct | 26 ms | 36008 KB | Output is correct |
7 | Correct | 27 ms | 36020 KB | Output is correct |
8 | Correct | 27 ms | 36052 KB | Output is correct |
9 | Correct | 26 ms | 36052 KB | Output is correct |
10 | Correct | 29 ms | 36068 KB | Output is correct |
11 | Correct | 26 ms | 36068 KB | Output is correct |
12 | Correct | 29 ms | 36068 KB | Output is correct |
13 | Correct | 27 ms | 36068 KB | Output is correct |
14 | Correct | 28 ms | 36196 KB | Output is correct |
15 | Correct | 238 ms | 36324 KB | Output is correct |
16 | Correct | 29 ms | 36324 KB | Output is correct |
17 | Correct | 62 ms | 36324 KB | Output is correct |
18 | Correct | 75 ms | 36324 KB | Output is correct |
19 | Correct | 316 ms | 36324 KB | Output is correct |
20 | Correct | 209 ms | 36324 KB | Output is correct |
21 | Correct | 147 ms | 36324 KB | Output is correct |
22 | Correct | 180 ms | 36324 KB | Output is correct |
23 | Correct | 111 ms | 36324 KB | Output is correct |
24 | Correct | 429 ms | 36324 KB | Output is correct |
25 | Correct | 293 ms | 36324 KB | Output is correct |
26 | Correct | 339 ms | 36324 KB | Output is correct |
27 | Correct | 368 ms | 36324 KB | Output is correct |