# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
310698 | 2020-10-07T16:18:14 Z | arnold518 | Tents (JOI18_tents) | C++14 | 155 ms | 71040 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 3000; const ll MOD = 1e9+7; int N, M; ll dp[MAXN+10][MAXN+10]; int main() { scanf("%d%d", &N, &M); for(int i=0; i<=N; i++) { for(int j=0; j<=M; j++) { if(i==0 || j==0) { dp[i][j]=1; continue; } if(j>=2) dp[i][j]+=(ll)j*(j-1)/2*dp[i-1][j-2]%MOD; dp[i][j]+=(ll)4*j*dp[i-1][j-1]%MOD; if(i>=2) dp[i][j]+=(ll)j*(i-1)*dp[i-2][j-1]%MOD; dp[i][j]+=dp[i-1][j]; dp[i][j]%=MOD; } } printf("%lld\n", (dp[N][M]+MOD-1)%MOD); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 1152 KB | Output is correct |
5 | Correct | 1 ms | 756 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 1 ms | 768 KB | Output is correct |
8 | Correct | 1 ms | 1408 KB | Output is correct |
9 | Correct | 1 ms | 768 KB | Output is correct |
10 | Correct | 2 ms | 1792 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 2304 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 1152 KB | Output is correct |
5 | Correct | 1 ms | 756 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 1 ms | 768 KB | Output is correct |
8 | Correct | 1 ms | 1408 KB | Output is correct |
9 | Correct | 1 ms | 768 KB | Output is correct |
10 | Correct | 2 ms | 1792 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 2304 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 9728 KB | Output is correct |
15 | Correct | 104 ms | 55244 KB | Output is correct |
16 | Correct | 7 ms | 4096 KB | Output is correct |
17 | Correct | 24 ms | 12928 KB | Output is correct |
18 | Correct | 30 ms | 17024 KB | Output is correct |
19 | Correct | 119 ms | 62968 KB | Output is correct |
20 | Correct | 97 ms | 50936 KB | Output is correct |
21 | Correct | 63 ms | 33912 KB | Output is correct |
22 | Correct | 65 ms | 35448 KB | Output is correct |
23 | Correct | 39 ms | 27128 KB | Output is correct |
24 | Correct | 155 ms | 71040 KB | Output is correct |
25 | Correct | 125 ms | 61432 KB | Output is correct |
26 | Correct | 138 ms | 66808 KB | Output is correct |
27 | Correct | 154 ms | 69112 KB | Output is correct |