# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164316 | 2019-11-19T11:14:46 Z | str0ct | Tents (JOI18_tents) | C++14 | 387 ms | 59384 KB |
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll mod=1e9+7; ll dp[3030][3030]; ll f(ll col,ll row){ //printf("%d%d\n",col,row); if(col<0||row<0)return 0; if(col==0||row==0)return 1; if(dp[col][row])return dp[col][row]; dp[col][row]+=(f(col-1,row)+4*row*f(col-1,row-1))%mod; dp[col][row]%=mod; dp[col][row]+=(row*(row-1)/2*f(col-1,row-2)+row*(col-1)*f(col-2,row-1))%mod; dp[col][row]%=mod; return dp[col][row]; } int main(){ ll H,W; scanf("%lld%lld",&H,&W); printf("%lld",f(H,W)-1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 3 ms | 1144 KB | Output is correct |
5 | Correct | 2 ms | 632 KB | Output is correct |
6 | Correct | 4 ms | 1400 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 4 ms | 1400 KB | Output is correct |
9 | Correct | 3 ms | 760 KB | Output is correct |
10 | Correct | 5 ms | 1784 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 6 ms | 2040 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 504 KB | Output is correct |
4 | Correct | 3 ms | 1144 KB | Output is correct |
5 | Correct | 2 ms | 632 KB | Output is correct |
6 | Correct | 4 ms | 1400 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 4 ms | 1400 KB | Output is correct |
9 | Correct | 3 ms | 760 KB | Output is correct |
10 | Correct | 5 ms | 1784 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 6 ms | 2040 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 13 ms | 9820 KB | Output is correct |
15 | Correct | 244 ms | 47424 KB | Output is correct |
16 | Correct | 5 ms | 1656 KB | Output is correct |
17 | Correct | 27 ms | 6904 KB | Output is correct |
18 | Correct | 58 ms | 13688 KB | Output is correct |
19 | Correct | 287 ms | 53680 KB | Output is correct |
20 | Correct | 218 ms | 42232 KB | Output is correct |
21 | Correct | 126 ms | 25580 KB | Output is correct |
22 | Correct | 141 ms | 30812 KB | Output is correct |
23 | Correct | 96 ms | 26492 KB | Output is correct |
24 | Correct | 387 ms | 59384 KB | Output is correct |
25 | Correct | 284 ms | 49656 KB | Output is correct |
26 | Correct | 325 ms | 55160 KB | Output is correct |
27 | Correct | 371 ms | 57464 KB | Output is correct |