# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
254554 | 2020-07-30T09:07:02 Z | babo | Tents (JOI18_tents) | C++14 | 145 ms | 71452 KB |
#include <bits/stdc++.h> #define L long long #define mod 1000000007ll using namespace std; L n,m; L dp[3030][3030]; int main() { scanf("%lld %lld",&n,&m); L i,j; for(i=0;i<=n;i++) dp[i][0]=1; for(j=0;j<=m;j++) dp[0][j]=1; for(i=1;i<=n;i++) { dp[i][1]=(1+4*i+i*(i-1)/2)%mod; for(j=2;j<=m;j++) { dp[i][j]+=dp[i][j-1]; if(i>=2) dp[i][j]+=dp[i-2][j-1]*(i*(i-1)/2%mod)%mod; dp[i][j]+=dp[i-1][j-1]*4*i%mod; dp[i][j]+=dp[i-1][j-2]*i%mod*(j-1)%mod; dp[i][j]%=mod; } } /*for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { printf("%lld ",dp[i][j]); } puts(""); }*/ printf("%lld",(dp[n][m]+mod-1)%mod); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 1152 KB | Output is correct |
5 | Correct | 1 ms | 768 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 1 ms | 896 KB | Output is correct |
8 | Correct | 1 ms | 1536 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 | 2 ms | 2304 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 512 KB | Output is correct |
4 | Correct | 1 ms | 1152 KB | Output is correct |
5 | Correct | 1 ms | 768 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 1 ms | 896 KB | Output is correct |
8 | Correct | 1 ms | 1536 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 | 2 ms | 2304 KB | Output is correct |
13 | Correct | 0 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 9728 KB | Output is correct |
15 | Correct | 93 ms | 55160 KB | Output is correct |
16 | Correct | 7 ms | 4096 KB | Output is correct |
17 | Correct | 21 ms | 12800 KB | Output is correct |
18 | Correct | 30 ms | 17144 KB | Output is correct |
19 | Correct | 112 ms | 62968 KB | Output is correct |
20 | Correct | 88 ms | 50936 KB | Output is correct |
21 | Correct | 62 ms | 33784 KB | Output is correct |
22 | Correct | 67 ms | 35448 KB | Output is correct |
23 | Correct | 38 ms | 27128 KB | Output is correct |
24 | Correct | 144 ms | 71452 KB | Output is correct |
25 | Correct | 123 ms | 61816 KB | Output is correct |
26 | Correct | 127 ms | 67260 KB | Output is correct |
27 | Correct | 145 ms | 69624 KB | Output is correct |