Submission #71543


ソースコード

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
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define ll long long
#define ptn(v) next_permutation(v.begin(), v.end())
#define fixed(v) fixed << setprecision(v)
#define total(n) (n * (n + 1) / 2)
#define lcm(a, b) ((a) * (b) / __gcd(a, b))
// binery_search(all(v),key) = keyがあるかないかをboolで返す
// lower_bound(all(v),key) = key以上のイテレーターを返す(一番左)
// upper_bound(all(v),key) = keyより大きい要素のイテレーターを返す
// 最小値=max_element(v.begin(),v.end());
// 最大値=min_element(v.begin(),v.end());
using namespace std;
int main(){
int p,n;
cin>>p>>n;
vector<vector<ll>> dp(n+1,vector<ll>(100000,0));
dp[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<n;j++){
if(j==0){
dp[i][j]=dp[i-1][j+1];
} else {
dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%100005;
}
}
}
cout<<dp[n-1][p]<<endl;
return (0);
}

ステータス

項目 データ
問題 0410 - メロディ作り
ユーザー名 ei2134
投稿日時 2022-07-27 12:25:27
言語 C++17
状態 Accepted
得点 10
ソースコード長 1019 Byte
最大実行時間 53 ms
最大メモリ使用量 63996 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
test01.txt AC 44 ms 19420 KB
1
test02.txt AC 19 ms 3008 KB
1
test03.txt AC 21 ms 9968 KB
1
test04.txt AC 47 ms 46864 KB
1
test05.txt AC 51 ms 53048 KB
1
test06.txt AC 42 ms 36584 KB
1
test07.txt AC 36 ms 20064 KB
1
test08.txt AC 41 ms 27188 KB
1
test09.txt AC 53 ms 63996 KB
1
test10.txt AC 47 ms 47568 KB
1