# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1033938 | 2024-07-25T07:57:29 Z | vjudge1 | Tents (JOI18_tents) | C++17 | 114 ms | 70964 KB |
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long // #define double long double #define endl '\n' #define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) #define fi first #define se second #define all(x) x.begin(), x.end() // mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count()); // int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 3e3 + 5; const int mod = 1e9 + 7; int w, h, f[NM][NM]; signed main() { fastIO if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } cin >> w >> h; for (int i = 0; i <= h; i++) f[0][i] = 1; for (int i = 1; i <= w; i++) for (int j = 0; j <= h; j++) { f[i][j] = f[i - 1][j - 1] * 4ll * j % mod; f[i][j] = (f[i][j] + f[i - 1][j]) % mod; if (j > 1 && i) f[i][j] = (f[i][j] + f[i - 1][j - 2] * ((j * (j - 1) / 2) % mod) % mod) % mod; if (i > 1 && j) f[i][j] = (f[i][j] + f[i - 2][j - 1] * j % mod * (i - 1) % mod) % mod; } cout << (f[w][h] + mod - 1) % mod << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 1536 KB | Output is correct |
7 | Correct | 1 ms | 860 KB | Output is correct |
8 | Correct | 1 ms | 1372 KB | Output is correct |
9 | Correct | 1 ms | 856 KB | Output is correct |
10 | Correct | 1 ms | 1884 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 2140 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 1536 KB | Output is correct |
7 | Correct | 1 ms | 860 KB | Output is correct |
8 | Correct | 1 ms | 1372 KB | Output is correct |
9 | Correct | 1 ms | 856 KB | Output is correct |
10 | Correct | 1 ms | 1884 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 2140 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 3 ms | 9564 KB | Output is correct |
15 | Correct | 75 ms | 55124 KB | Output is correct |
16 | Correct | 5 ms | 4188 KB | Output is correct |
17 | Correct | 17 ms | 12892 KB | Output is correct |
18 | Correct | 21 ms | 16988 KB | Output is correct |
19 | Correct | 86 ms | 63060 KB | Output is correct |
20 | Correct | 68 ms | 51040 KB | Output is correct |
21 | Correct | 49 ms | 33964 KB | Output is correct |
22 | Correct | 54 ms | 35364 KB | Output is correct |
23 | Correct | 33 ms | 27228 KB | Output is correct |
24 | Correct | 114 ms | 70964 KB | Output is correct |
25 | Correct | 87 ms | 61268 KB | Output is correct |
26 | Correct | 105 ms | 66620 KB | Output is correct |
27 | Correct | 111 ms | 69036 KB | Output is correct |