Submission #49037


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'
using namespace std;
typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;
static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 3005;
int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};
LL dp[SIZE][SIZE];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
LL n, m;
cin >> n >> m;
for( LL i = 1; i <= m; ++i ) {
for( LL j = 1; j <= min( i + 1, n ); ++j ) {
if( i == 1 ) dp[i][j] = 1;
else {
dp[i][j] = ( dp[i - 1][j - 1] + dp[i - 1][j] + dp[i - 1][j + 1] ) % MOD;
}
}
}
cout << dp[m][n] << endl;
return 0;
}

ステータス

項目 データ
問題 1107 - 脱出ゲーム
ユーザー名 crom
投稿日時 2019-05-06 20:06:45
言語 C++11
状態 Accepted
得点 1
ソースコード長 1005 Byte
最大実行時間 38 ms
最大メモリ使用量 69340 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
case01.in AC 34 ms 69340 KB
1
case02.in AC 38 ms 69108 KB
1
case03.in AC 33 ms 69152 KB
1
case04.in AC 33 ms 69088 KB
1
case05.in AC 32 ms 68988 KB
1
case06.in AC 28 ms 39844 KB
1
case07.in AC 24 ms 68720 KB
1
case08.in AC 24 ms 68692 KB
1
case09.in AC 31 ms 68920 KB
1
case10.in AC 24 ms 11140 KB
1
sample01.in AC 20 ms 592 KB
1
sample02.in AC 14 ms 656 KB
1
sample03.in AC 23 ms 840 KB
1