# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
57035 | 2018-07-13T16:32:58 Z | cki86201 | Tents (JOI18_tents) | C++11 | 127 ms | 72000 KB |
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> using namespace std; typedef pair<int, int> Pi; typedef long long ll; #define Fi first #define Se second #define pb(x) push_back(x) #define sz(x) (int)x.size() #define rep(i, n) for(int i=0;i<n;i++) #define all(x) x.begin(), x.end() const int MOD = 1e9 + 7; ll d[3030][3030]; void solve(){ int n, m; scanf("%d%d", &n, &m); rep(i, 3030) d[i][0] = d[0][i] = 1; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { d[i][j] = d[i-1][j] + 4LL * d[i-1][j-1] * j; if(j >= 2) d[i][j] += j * (j-1) / 2 * d[i-1][j-2]; if(i >= 2) d[i][j] += j * (i-1) * d[i-2][j-1]; d[i][j] %= MOD; } } printf("%lld\n", (d[n][m] + MOD - 1) % MOD); } int main(){ int Tc = 1; //scanf("%d", &Tc); for(int tc=1;tc<=Tc;tc++){ solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 12536 KB | Output is correct |
2 | Correct | 11 ms | 12684 KB | Output is correct |
3 | Correct | 10 ms | 12684 KB | Output is correct |
4 | Correct | 10 ms | 12744 KB | Output is correct |
5 | Correct | 12 ms | 12788 KB | Output is correct |
6 | Correct | 14 ms | 12808 KB | Output is correct |
7 | Correct | 12 ms | 12944 KB | Output is correct |
8 | Correct | 12 ms | 12956 KB | Output is correct |
9 | Correct | 11 ms | 12956 KB | Output is correct |
10 | Correct | 12 ms | 13116 KB | Output is correct |
11 | Correct | 12 ms | 13116 KB | Output is correct |
12 | Correct | 14 ms | 13588 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 12536 KB | Output is correct |
2 | Correct | 11 ms | 12684 KB | Output is correct |
3 | Correct | 10 ms | 12684 KB | Output is correct |
4 | Correct | 10 ms | 12744 KB | Output is correct |
5 | Correct | 12 ms | 12788 KB | Output is correct |
6 | Correct | 14 ms | 12808 KB | Output is correct |
7 | Correct | 12 ms | 12944 KB | Output is correct |
8 | Correct | 12 ms | 12956 KB | Output is correct |
9 | Correct | 11 ms | 12956 KB | Output is correct |
10 | Correct | 12 ms | 13116 KB | Output is correct |
11 | Correct | 12 ms | 13116 KB | Output is correct |
12 | Correct | 14 ms | 13588 KB | Output is correct |
13 | Correct | 13 ms | 13588 KB | Output is correct |
14 | Correct | 11 ms | 13588 KB | Output is correct |
15 | Correct | 65 ms | 56616 KB | Output is correct |
16 | Correct | 16 ms | 56616 KB | Output is correct |
17 | Correct | 31 ms | 56616 KB | Output is correct |
18 | Correct | 26 ms | 56616 KB | Output is correct |
19 | Correct | 90 ms | 63788 KB | Output is correct |
20 | Correct | 74 ms | 63788 KB | Output is correct |
21 | Correct | 67 ms | 63788 KB | Output is correct |
22 | Correct | 45 ms | 63788 KB | Output is correct |
23 | Correct | 36 ms | 63788 KB | Output is correct |
24 | Correct | 127 ms | 72000 KB | Output is correct |
25 | Correct | 72 ms | 72000 KB | Output is correct |
26 | Correct | 78 ms | 72000 KB | Output is correct |
27 | Correct | 99 ms | 72000 KB | Output is correct |