# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68617 | 2018-08-17T14:34:40 Z | TadijaSebez | Tents (JOI18_tents) | C++11 | 218 ms | 36004 KB |
#include <stdio.h> #define ll long long const int N=3005; const int mod=1e9+7; int dp[N][N]; int main() { int n,m,i,j; scanf("%i %i",&n,&m); for(i=0;i<=n;i++) { for(j=0;j<=m;j++) { if(i==0 || j==0){ dp[i][j]=1;continue;} dp[i][j]=dp[i-1][j]+(ll)dp[i-1][j-1]*j%mod*4%mod; dp[i][j]%=mod; if(i>1) dp[i][j]+=(ll)dp[i-2][j-1]*j%mod*(i-1)%mod; dp[i][j]%=mod; if(j>1) dp[i][j]+=(ll)dp[i-1][j-2]*((ll)j*(j-1)/2%mod)%mod; dp[i][j]%=mod; } } printf("%i\n",(dp[n][m]+mod-1)%mod); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 728 KB | Output is correct |
4 | Correct | 3 ms | 1412 KB | Output is correct |
5 | Correct | 3 ms | 1412 KB | Output is correct |
6 | Correct | 4 ms | 1488 KB | Output is correct |
7 | Correct | 3 ms | 1488 KB | Output is correct |
8 | Correct | 5 ms | 1668 KB | Output is correct |
9 | Correct | 3 ms | 1668 KB | Output is correct |
10 | Correct | 4 ms | 1932 KB | Output is correct |
11 | Correct | 2 ms | 1932 KB | Output is correct |
12 | Correct | 5 ms | 2068 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 728 KB | Output is correct |
4 | Correct | 3 ms | 1412 KB | Output is correct |
5 | Correct | 3 ms | 1412 KB | Output is correct |
6 | Correct | 4 ms | 1488 KB | Output is correct |
7 | Correct | 3 ms | 1488 KB | Output is correct |
8 | Correct | 5 ms | 1668 KB | Output is correct |
9 | Correct | 3 ms | 1668 KB | Output is correct |
10 | Correct | 4 ms | 1932 KB | Output is correct |
11 | Correct | 2 ms | 1932 KB | Output is correct |
12 | Correct | 5 ms | 2068 KB | Output is correct |
13 | Correct | 2 ms | 2068 KB | Output is correct |
14 | Correct | 9 ms | 9884 KB | Output is correct |
15 | Correct | 143 ms | 33108 KB | Output is correct |
16 | Correct | 12 ms | 33108 KB | Output is correct |
17 | Correct | 32 ms | 33108 KB | Output is correct |
18 | Correct | 45 ms | 33108 KB | Output is correct |
19 | Correct | 175 ms | 34968 KB | Output is correct |
20 | Correct | 151 ms | 34968 KB | Output is correct |
21 | Correct | 95 ms | 34968 KB | Output is correct |
22 | Correct | 96 ms | 34968 KB | Output is correct |
23 | Correct | 64 ms | 34968 KB | Output is correct |
24 | Correct | 218 ms | 36004 KB | Output is correct |
25 | Correct | 213 ms | 36004 KB | Output is correct |
26 | Correct | 179 ms | 36004 KB | Output is correct |
27 | Correct | 205 ms | 36004 KB | Output is correct |