Submission #197500

# Submission time Handle Problem Language Result Execution time Memory
197500 2020-01-21T13:15:20 Z handlename Tents (JOI18_tents) C++17
100 / 100
326 ms 32028 KB
#include <bits/stdc++.h>
using namespace std;
int h,w;
int memo[3001][3001];
long long dp(int a,int b){
    if (a<=0 || b<=0) return 1;
    if (memo[a][b]!=0) return memo[a][b];
    long long ans=0;
    ans+=dp(a-1,b);
    ans+=4*b*dp(a-1,b-1);
    ans+=((b*(b-1))/2)*dp(a-1,b-2);
    ans+=(b*(a-1))*dp(a-2,b-1);
    ans%=1000000007;
    return memo[a][b]=ans;
}
int main() {
    cin>>h>>w;
    cout<<dp(h,w)-1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 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 1272 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 1656 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 6 ms 1784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 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 1272 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 1656 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 6 ms 1784 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 13 ms 9720 KB Output is correct
15 Correct 214 ms 29176 KB Output is correct
16 Correct 5 ms 1528 KB Output is correct
17 Correct 24 ms 5112 KB Output is correct
18 Correct 51 ms 9336 KB Output is correct
19 Correct 249 ms 30844 KB Output is correct
20 Correct 187 ms 25464 KB Output is correct
21 Correct 109 ms 16120 KB Output is correct
22 Correct 127 ms 19960 KB Output is correct
23 Correct 84 ms 19576 KB Output is correct
24 Correct 326 ms 32028 KB Output is correct
25 Correct 258 ms 27128 KB Output is correct
26 Correct 288 ms 30072 KB Output is correct
27 Correct 307 ms 31096 KB Output is correct