# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164045 | 2019-11-17T07:13:01 Z | georgerapeanu | Tents (JOI18_tents) | C++11 | 149 ms | 35576 KB |
#include <cstdio> #include <algorithm> using namespace std; const int XMAX = 3000; const int MOD = 1e9 + 7; int dp[XMAX + 5][XMAX + 5]; int main(){ for(int i = 0;i <= XMAX + 2;i++){ dp[i][0] = dp[0][i] = 1; } int h,w; scanf("%d %d",&h,&w); for(int i = 1;i <= h;i++){ for(int j = 1;j <= w;j++){ dp[i][j] = dp[i - 1][j]; dp[i][j] = (dp[i][j] + 4LL * dp[i - 1][j - 1] * j) % MOD; if(j > 1)dp[i][j] = (dp[i][j] + 1LL * dp[i - 1][j - 2] * j * (j - 1) / 2) % MOD; if(i > 1)dp[i][j] = (dp[i][j] + 1LL * dp[i - 2][j - 1] * j * (i - 1)) % MOD; } } printf("%d\n",(dp[h][w] == 0 ? MOD - 1:dp[h][w] - 1)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12408 KB | Output is correct |
2 | Correct | 11 ms | 12408 KB | Output is correct |
3 | Correct | 12 ms | 12408 KB | Output is correct |
4 | Correct | 11 ms | 12408 KB | Output is correct |
5 | Correct | 11 ms | 12408 KB | Output is correct |
6 | Correct | 11 ms | 12536 KB | Output is correct |
7 | Correct | 12 ms | 12536 KB | Output is correct |
8 | Correct | 12 ms | 12408 KB | Output is correct |
9 | Correct | 11 ms | 12412 KB | Output is correct |
10 | Correct | 12 ms | 12536 KB | Output is correct |
11 | Correct | 12 ms | 12408 KB | Output is correct |
12 | Correct | 22 ms | 12792 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 12408 KB | Output is correct |
2 | Correct | 11 ms | 12408 KB | Output is correct |
3 | Correct | 12 ms | 12408 KB | Output is correct |
4 | Correct | 11 ms | 12408 KB | Output is correct |
5 | Correct | 11 ms | 12408 KB | Output is correct |
6 | Correct | 11 ms | 12536 KB | Output is correct |
7 | Correct | 12 ms | 12536 KB | Output is correct |
8 | Correct | 12 ms | 12408 KB | Output is correct |
9 | Correct | 11 ms | 12412 KB | Output is correct |
10 | Correct | 12 ms | 12536 KB | Output is correct |
11 | Correct | 12 ms | 12408 KB | Output is correct |
12 | Correct | 22 ms | 12792 KB | Output is correct |
13 | Correct | 12 ms | 12412 KB | Output is correct |
14 | Correct | 12 ms | 12408 KB | Output is correct |
15 | Correct | 149 ms | 33784 KB | Output is correct |
16 | Correct | 16 ms | 13816 KB | Output is correct |
17 | Correct | 27 ms | 17272 KB | Output is correct |
18 | Correct | 30 ms | 18424 KB | Output is correct |
19 | Correct | 88 ms | 34908 KB | Output is correct |
20 | Correct | 102 ms | 31312 KB | Output is correct |
21 | Correct | 53 ms | 25208 KB | Output is correct |
22 | Correct | 54 ms | 25592 KB | Output is correct |
23 | Correct | 84 ms | 19832 KB | Output is correct |
24 | Correct | 112 ms | 35576 KB | Output is correct |
25 | Correct | 106 ms | 32372 KB | Output is correct |
26 | Correct | 98 ms | 34124 KB | Output is correct |
27 | Correct | 108 ms | 34936 KB | Output is correct |