# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72578 | 2018-08-26T09:53:08 Z | Abelyan | Tents (JOI18_tents) | C++17 | 137 ms | 71364 KB |
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <queue> #include <map> #include <set> #include <cmath> using namespace std; typedef long long ll; const int N = 3006; const ll MOD = 1000000007; ll dp[N][N]; int main() { ios_base::sync_with_stdio(false); int n,m; cin >> n >> m; for (int i = 1; i <= max(n,m); i++) { dp[0][i]=dp[i][0] = 1; dp[1][i]=dp[i][1] = i*(i - 1) / 2 + 4 * i + 1; } for (ll i = 2; i <= n; i++) { for (ll j = 2; j <= m; j++) { dp[i][j] = (i * 4 * dp[i - 1][j - 1] + i*(j - 1)*dp[i - 1][j - 2] + dp[i][j - 1] + (i*(i - 1) / 2) * dp[i - 2][j - 1]) % MOD; } } cout << dp[n][m]-1 << endl; system("pause"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 1128 KB | Output is correct |
3 | Correct | 4 ms | 1128 KB | Output is correct |
4 | Correct | 4 ms | 1464 KB | Output is correct |
5 | Correct | 5 ms | 1928 KB | Output is correct |
6 | Correct | 4 ms | 1928 KB | Output is correct |
7 | Correct | 4 ms | 1928 KB | Output is correct |
8 | Correct | 4 ms | 1928 KB | Output is correct |
9 | Correct | 5 ms | 1928 KB | Output is correct |
10 | Correct | 4 ms | 2164 KB | Output is correct |
11 | Correct | 4 ms | 2164 KB | Output is correct |
12 | Correct | 6 ms | 2720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 1128 KB | Output is correct |
3 | Correct | 4 ms | 1128 KB | Output is correct |
4 | Correct | 4 ms | 1464 KB | Output is correct |
5 | Correct | 5 ms | 1928 KB | Output is correct |
6 | Correct | 4 ms | 1928 KB | Output is correct |
7 | Correct | 4 ms | 1928 KB | Output is correct |
8 | Correct | 4 ms | 1928 KB | Output is correct |
9 | Correct | 5 ms | 1928 KB | Output is correct |
10 | Correct | 4 ms | 2164 KB | Output is correct |
11 | Correct | 4 ms | 2164 KB | Output is correct |
12 | Correct | 6 ms | 2720 KB | Output is correct |
13 | Correct | 10 ms | 8224 KB | Output is correct |
14 | Correct | 11 ms | 10144 KB | Output is correct |
15 | Correct | 104 ms | 55696 KB | Output is correct |
16 | Correct | 16 ms | 55696 KB | Output is correct |
17 | Correct | 28 ms | 55696 KB | Output is correct |
18 | Correct | 31 ms | 55696 KB | Output is correct |
19 | Correct | 108 ms | 63332 KB | Output is correct |
20 | Correct | 94 ms | 63332 KB | Output is correct |
21 | Correct | 62 ms | 63332 KB | Output is correct |
22 | Correct | 65 ms | 63332 KB | Output is correct |
23 | Correct | 42 ms | 63332 KB | Output is correct |
24 | Correct | 137 ms | 71364 KB | Output is correct |
25 | Correct | 112 ms | 71364 KB | Output is correct |
26 | Correct | 135 ms | 71364 KB | Output is correct |
27 | Correct | 136 ms | 71364 KB | Output is correct |