# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
78495 | 2018-10-05T13:48:18 Z | nxteru | Tents (JOI18_tents) | C++14 | 219 ms | 71272 KB |
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cstdio> #include <cstring> #include <string> #include <math.h> using namespace std; typedef long long ll; typedef double D; typedef pair<int,int> P; #define M 1000000007 #define F first #define S second #define PB push_back #define INF 1000000000 ll h,w,dp[3005][3005],ans=-1; int main(void){ scanf("%lld%lld",&h,&w); dp[h][w]=1; for(ll i=h;i>0;i--){ for(ll j=w;j>=0;j--){ if(j>=2)dp[i-1][j-2]=(dp[i-1][j-2]+dp[i][j]*(j*(j-1)/2)%M)%M; if(j>0)dp[i-1][j-1]=(dp[i-1][j-1]+dp[i][j]*4*j%M)%M; if(i>=2&&j>0)dp[i-2][j-1]=(dp[i-2][j-1]+dp[i][j]*(i-1)*j%M)%M; dp[i-1][j]=(dp[i-1][j]+dp[i][j])%M; } } for(int j=0;j<=w;j++)ans=(ans+dp[0][j])%M; printf("%lld\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 584 KB | Output is correct |
4 | Correct | 3 ms | 1228 KB | Output is correct |
5 | Correct | 3 ms | 1228 KB | Output is correct |
6 | Correct | 4 ms | 1536 KB | Output is correct |
7 | Correct | 3 ms | 1536 KB | Output is correct |
8 | Correct | 4 ms | 1612 KB | Output is correct |
9 | Correct | 3 ms | 1612 KB | Output is correct |
10 | Correct | 4 ms | 1948 KB | Output is correct |
11 | Correct | 2 ms | 1948 KB | Output is correct |
12 | Correct | 5 ms | 2388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 584 KB | Output is correct |
4 | Correct | 3 ms | 1228 KB | Output is correct |
5 | Correct | 3 ms | 1228 KB | Output is correct |
6 | Correct | 4 ms | 1536 KB | Output is correct |
7 | Correct | 3 ms | 1536 KB | Output is correct |
8 | Correct | 4 ms | 1612 KB | Output is correct |
9 | Correct | 3 ms | 1612 KB | Output is correct |
10 | Correct | 4 ms | 1948 KB | Output is correct |
11 | Correct | 2 ms | 1948 KB | Output is correct |
12 | Correct | 5 ms | 2388 KB | Output is correct |
13 | Correct | 2 ms | 2388 KB | Output is correct |
14 | Correct | 13 ms | 9988 KB | Output is correct |
15 | Correct | 154 ms | 55596 KB | Output is correct |
16 | Correct | 14 ms | 55596 KB | Output is correct |
17 | Correct | 34 ms | 55596 KB | Output is correct |
18 | Correct | 48 ms | 55596 KB | Output is correct |
19 | Correct | 170 ms | 63260 KB | Output is correct |
20 | Correct | 137 ms | 63260 KB | Output is correct |
21 | Correct | 124 ms | 63260 KB | Output is correct |
22 | Correct | 92 ms | 63260 KB | Output is correct |
23 | Correct | 60 ms | 63260 KB | Output is correct |
24 | Correct | 219 ms | 71272 KB | Output is correct |
25 | Correct | 173 ms | 71272 KB | Output is correct |
26 | Correct | 192 ms | 71272 KB | Output is correct |
27 | Correct | 218 ms | 71272 KB | Output is correct |