# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236802 |
2020-06-03T11:32:09 Z |
uacoder123 |
Tents (JOI18_tents) |
C++14 |
|
256 ms |
63352 KB |
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <ii,lli> iii;
typedef vector <lli> vi;
lli dp[3001][3001]={};
lli m=1000000007;
lli cal(lli h,lli w)
{
if(h<=0||w<=0)
return(1);
if(dp[h][w])
return(dp[h][w]);
dp[h][w]=((((h*(h-1))/2)*cal(h-2,w-1))%m+(4*h*cal(h-1,w-1))%m+(h*(w-1)*cal(h-1,w-2))%m+cal(h,w-1))%m;
return(dp[h][w]);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli test;
test=1;
for(;test>0;--test)
{
dp[1][1]=5;
lli h,w;
cin>>h>>w;
cout<<(cal(h,w)-1+m)%m<<endl;
}
return(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
5 ms |
1152 KB |
Output is correct |
7 |
Correct |
5 ms |
768 KB |
Output is correct |
8 |
Correct |
6 ms |
896 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
1664 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
2176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
5 ms |
1152 KB |
Output is correct |
7 |
Correct |
5 ms |
768 KB |
Output is correct |
8 |
Correct |
6 ms |
896 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
1664 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
8 ms |
2176 KB |
Output is correct |
13 |
Correct |
5 ms |
512 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
155 ms |
40440 KB |
Output is correct |
16 |
Correct |
23 ms |
4096 KB |
Output is correct |
17 |
Correct |
48 ms |
12152 KB |
Output is correct |
18 |
Correct |
55 ms |
14584 KB |
Output is correct |
19 |
Correct |
179 ms |
46712 KB |
Output is correct |
20 |
Correct |
150 ms |
39448 KB |
Output is correct |
21 |
Correct |
116 ms |
28668 KB |
Output is correct |
22 |
Correct |
99 ms |
26488 KB |
Output is correct |
23 |
Correct |
23 ms |
8448 KB |
Output is correct |
24 |
Correct |
252 ms |
63352 KB |
Output is correct |
25 |
Correct |
196 ms |
50012 KB |
Output is correct |
26 |
Correct |
234 ms |
55800 KB |
Output is correct |
27 |
Correct |
256 ms |
61516 KB |
Output is correct |