# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1033966 | 2024-07-25T08:09:17 Z | vjudge1 | Tents (JOI18_tents) | C++14 | 93 ms | 70844 KB |
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; #define name "aaaaaa" using ll = long long; using pll = pair<ll, ll>; using ld = long double; void file(){ ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } } const int maxn = 3e3 + 5; const ll mod = 1e9 + 7; ll dp[maxn][maxn]; void solve (){ int n, m; cin >> n >> m; for(int i = 0; i < maxn; i++){ dp[0][i] = 1; dp[i][0] = 1; } for(ll i = 1; i <= n; i++){ for(ll j = 1; j <= m; j++){ dp[i][j] += dp[i - 1][j]; dp[i][j] += dp[i - 1][j - 1] * 4 * j % mod; if(j >= 2) dp[i][j] += dp[i - 1][j - 2] * (j * (j - 1) / 2 % mod) % mod; if(i >= 2) dp[i][j] += j * (i - 1) % mod * dp[i - 2][j - 1] % mod; dp[i][j] %= mod; } } dp[n][m]--; if(dp[n][m] < 0) dp[n][m] += mod; cout << dp[n][m]; } int main(){ file(); int t = 1; //cin >> t; while(t--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 27740 KB | Output is correct |
2 | Correct | 7 ms | 27728 KB | Output is correct |
3 | Correct | 5 ms | 26204 KB | Output is correct |
4 | Correct | 5 ms | 27884 KB | Output is correct |
5 | Correct | 7 ms | 36188 KB | Output is correct |
6 | Correct | 5 ms | 37980 KB | Output is correct |
7 | Correct | 5 ms | 36188 KB | Output is correct |
8 | Correct | 6 ms | 37980 KB | Output is correct |
9 | Correct | 6 ms | 36188 KB | Output is correct |
10 | Correct | 7 ms | 37980 KB | Output is correct |
11 | Correct | 5 ms | 36212 KB | Output is correct |
12 | Correct | 8 ms | 37904 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 27740 KB | Output is correct |
2 | Correct | 7 ms | 27728 KB | Output is correct |
3 | Correct | 5 ms | 26204 KB | Output is correct |
4 | Correct | 5 ms | 27884 KB | Output is correct |
5 | Correct | 7 ms | 36188 KB | Output is correct |
6 | Correct | 5 ms | 37980 KB | Output is correct |
7 | Correct | 5 ms | 36188 KB | Output is correct |
8 | Correct | 6 ms | 37980 KB | Output is correct |
9 | Correct | 6 ms | 36188 KB | Output is correct |
10 | Correct | 7 ms | 37980 KB | Output is correct |
11 | Correct | 5 ms | 36212 KB | Output is correct |
12 | Correct | 8 ms | 37904 KB | Output is correct |
13 | Correct | 5 ms | 37888 KB | Output is correct |
14 | Correct | 5 ms | 36188 KB | Output is correct |
15 | Correct | 65 ms | 61096 KB | Output is correct |
16 | Correct | 8 ms | 38144 KB | Output is correct |
17 | Correct | 13 ms | 37976 KB | Output is correct |
18 | Correct | 16 ms | 38192 KB | Output is correct |
19 | Correct | 71 ms | 65932 KB | Output is correct |
20 | Correct | 53 ms | 56748 KB | Output is correct |
21 | Correct | 33 ms | 43348 KB | Output is correct |
22 | Correct | 40 ms | 47764 KB | Output is correct |
23 | Correct | 26 ms | 44904 KB | Output is correct |
24 | Correct | 93 ms | 70844 KB | Output is correct |
25 | Correct | 71 ms | 62812 KB | Output is correct |
26 | Correct | 76 ms | 67420 KB | Output is correct |
27 | Correct | 82 ms | 69452 KB | Output is correct |