# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
995549 |
2024-06-09T10:32:03 Z |
mariamp1 |
Tents (JOI18_tents) |
C++14 |
|
50 ms |
70788 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3005;
int dp[3005][3005];
const int mod = 1e9 + 7;
int32_t main(){
int h, w; cin >> h >> w;
int ans = 0;
for(int i = 1; i <= h; i++){
for(int j = 1; j <= w; j++){
ans=0;
ans += dp[i-1][j];
if(j > 1){
ans += (j * (j-1))/2 * (dp[i-1][j-2]+1);
}
ans += (dp[i-1][j-1]+1) * j * 4;
if(i > 1){
ans += (dp[i-2][j - 1] + 1) * (i-1) * (j);
}
ans %= mod;
dp[i][j]=ans;
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
0 ms |
860 KB |
Output is correct |
10 |
Correct |
1 ms |
1692 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
2236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
1372 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
0 ms |
860 KB |
Output is correct |
10 |
Correct |
1 ms |
1692 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
2236 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
4 ms |
9564 KB |
Output is correct |
15 |
Correct |
37 ms |
55380 KB |
Output is correct |
16 |
Correct |
3 ms |
4696 KB |
Output is correct |
17 |
Correct |
9 ms |
13308 KB |
Output is correct |
18 |
Correct |
10 ms |
17756 KB |
Output is correct |
19 |
Correct |
40 ms |
63056 KB |
Output is correct |
20 |
Correct |
32 ms |
51196 KB |
Output is correct |
21 |
Correct |
21 ms |
33976 KB |
Output is correct |
22 |
Correct |
24 ms |
36056 KB |
Output is correct |
23 |
Correct |
15 ms |
28252 KB |
Output is correct |
24 |
Correct |
48 ms |
70788 KB |
Output is correct |
25 |
Correct |
40 ms |
61268 KB |
Output is correct |
26 |
Correct |
49 ms |
66648 KB |
Output is correct |
27 |
Correct |
50 ms |
68948 KB |
Output is correct |