Submission #56418
ソースコード
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #include <set> #include <map> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <vector> #include <string> #include <bitset> #include <cctype> #include <cstdlib> #include <cstring> #include <utility> #include <numeric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> using namespace std; typedef long long ll; typedef vector< int > vint; typedef pair< int , int > pint; typedef vector< long long > vlong; #define vpush(a,x) a.push_back(x); #define rep(i, n) REP(i, 0, n) #define all(v) v.begin(), v.end() #define REP(i, x, n) for(int i = x; i < n; i++) #define INF 2e9 int fact( int n){ int m; if (n == 0) return 1; m = fact(n - 1); return n * m; } signed main(){ cin.tie(0); ios::sync_with_stdio( false ); long long n,m,p=1000000007; cin>>n>>m; vector<vector< long long > > dp(3005,vector< long long >(3005)); dp[0][0]++; if (n!=1){ REP(i,1,m+1){ for ( long long j=n-1;j>=0;j--){ if (j==n-1){ dp[i][j]=(dp[i-1][j-1]+dp[i-1][j])%p; } else if (j==0){ dp[i][j]=(dp[i-1][j]+dp[i-1][j+1])%p; } else { dp[i][j]=(dp[i-1][j]+dp[i-1][j-1]+dp[i-1][j+1])%p; } } } cout<<dp[m][n-1]<< '\n' ; } else { cout<<1<< '\n' ; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1107 - 脱出ゲーム |
ユーザー名 | ei1918 |
投稿日時 | 2019-11-13 19:18:21 |
言語 | C++ |
状態 | Accepted |
得点 | 1 |
ソースコード長 | 1492 Byte |
最大実行時間 | 79 ms |
最大メモリ使用量 | 71388 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 1 / 1 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
case01.in | AC | 76 ms | 71260 KB |
1
|
case02.in | AC | 78 ms | 71332 KB |
1
|
case03.in | AC | 79 ms | 71276 KB |
1
|
case04.in | AC | 62 ms | 71348 KB |
1
|
case05.in | AC | 72 ms | 71292 KB |
1
|
case06.in | AC | 67 ms | 71240 KB |
1
|
case07.in | AC | 61 ms | 71316 KB |
1
|
case08.in | AC | 58 ms | 71132 KB |
1
|
case09.in | AC | 70 ms | 71212 KB |
1
|
case10.in | AC | 58 ms | 71160 KB |
1
|
sample01.in | AC | 62 ms | 71236 KB |
1
|
sample02.in | AC | 57 ms | 71312 KB |
1
|
sample03.in | AC | 65 ms | 71388 KB |
1
|