# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44119 | 2018-03-30T05:04:02 Z | khsoo01 | Tents (JOI18_tents) | C++11 | 84 ms | 71168 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 3005, M = 1e9+7; ll h, w, dt[N][N]; int main() { scanf("%lld%lld",&h,&w); for(ll i=0;i<=w;i++) dt[0][i] = 1; for(ll i=1;i<=h;i++) { dt[i][0] = 1; for(ll j=1;j<=w;j++) { dt[i][j] = dt[i-1][j] + 4*j*dt[i-1][j-1]; if(i >= 2) dt[i][j] += dt[i-2][j-1]*j*(i-1); if(j >= 2) dt[i][j] += dt[i-1][j-2]*j*(j-1)/2; dt[i][j] %= M; } } printf("%lld\n",(dt[h][w]+M-1)%M); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 1328 KB | Output is correct |
5 | Correct | 2 ms | 1328 KB | Output is correct |
6 | Correct | 2 ms | 1540 KB | Output is correct |
7 | Correct | 2 ms | 1540 KB | Output is correct |
8 | Correct | 2 ms | 1540 KB | Output is correct |
9 | Correct | 2 ms | 1540 KB | Output is correct |
10 | Correct | 3 ms | 1948 KB | Output is correct |
11 | Correct | 2 ms | 1948 KB | Output is correct |
12 | Correct | 3 ms | 2564 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 1328 KB | Output is correct |
5 | Correct | 2 ms | 1328 KB | Output is correct |
6 | Correct | 2 ms | 1540 KB | Output is correct |
7 | Correct | 2 ms | 1540 KB | Output is correct |
8 | Correct | 2 ms | 1540 KB | Output is correct |
9 | Correct | 2 ms | 1540 KB | Output is correct |
10 | Correct | 3 ms | 1948 KB | Output is correct |
11 | Correct | 2 ms | 1948 KB | Output is correct |
12 | Correct | 3 ms | 2564 KB | Output is correct |
13 | Correct | 2 ms | 2564 KB | Output is correct |
14 | Correct | 7 ms | 10024 KB | Output is correct |
15 | Correct | 60 ms | 55484 KB | Output is correct |
16 | Correct | 5 ms | 55484 KB | Output is correct |
17 | Correct | 15 ms | 55484 KB | Output is correct |
18 | Correct | 19 ms | 55484 KB | Output is correct |
19 | Correct | 69 ms | 63216 KB | Output is correct |
20 | Correct | 56 ms | 63216 KB | Output is correct |
21 | Correct | 38 ms | 63216 KB | Output is correct |
22 | Correct | 41 ms | 63216 KB | Output is correct |
23 | Correct | 26 ms | 63216 KB | Output is correct |
24 | Correct | 84 ms | 71168 KB | Output is correct |
25 | Correct | 71 ms | 71168 KB | Output is correct |
26 | Correct | 76 ms | 71168 KB | Output is correct |
27 | Correct | 83 ms | 71168 KB | Output is correct |