# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
952910 | 2024-03-25T04:59:30 Z | bananade | Tents (JOI18_tents) | C++17 | 266 ms | 70796 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int dp[3005][3005]; int h, w; int mod = 1000000007; int pang(int a) { int jum = 1; int now = 1e9 + 6; vector<int> v; while(now > 0) { if(now % 2 == 1) { v.push_back(1); now--; } else { v.push_back(2); now /= 2; } } } signed main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); cin >> h >> w; for(int i = 0; i <= h; i++) { for(int j = 0; j <= w; j++) { if(i == 0 || j == 0) { dp[i][j] = 1; } else { dp[i][j] = dp[i - 1][j] + (dp[i - 1][j - 1] * j * 4); dp[i][j] %= mod; if(i >= 2) { int a = dp[i - 2][j - 1] * (i - 1) * j; a %= mod; dp[i][j] += a; dp[i][j] %= mod; } if(j >= 2) { int a = dp[i - 1][j - 2] * (j - 1) * j / 2; a %= mod; dp[i][j] += a; dp[i][j] %= mod; } } //cout << i << " " << j << " " << dp[i][j] << "\n"; } } cout << dp[h][w] - 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 2 ms | 6492 KB | Output is correct |
7 | Correct | 2 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 6660 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 3 ms | 8652 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 4 ms | 8704 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 2 ms | 6492 KB | Output is correct |
7 | Correct | 2 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 6660 KB | Output is correct |
9 | Correct | 1 ms | 4444 KB | Output is correct |
10 | Correct | 3 ms | 8652 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 4 ms | 8704 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 21 ms | 55880 KB | Output is correct |
15 | Correct | 169 ms | 66236 KB | Output is correct |
16 | Correct | 11 ms | 6744 KB | Output is correct |
17 | Correct | 37 ms | 16988 KB | Output is correct |
18 | Correct | 46 ms | 29268 KB | Output is correct |
19 | Correct | 195 ms | 70488 KB | Output is correct |
20 | Correct | 155 ms | 57936 KB | Output is correct |
21 | Correct | 102 ms | 39556 KB | Output is correct |
22 | Correct | 100 ms | 51792 KB | Output is correct |
23 | Correct | 58 ms | 70480 KB | Output is correct |
24 | Correct | 266 ms | 70796 KB | Output is correct |
25 | Correct | 196 ms | 62088 KB | Output is correct |
26 | Correct | 225 ms | 68320 KB | Output is correct |
27 | Correct | 255 ms | 70228 KB | Output is correct |