結果

問題 No.2511 Mountain Sequence
ユーザー daiotadaiota
提出日時 2023-10-25 10:17:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 1,854 ms
コンパイル使用メモリ 167,364 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2023-10-25 10:17:28
合計ジャッジ時間 4,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
12,928 KB
testcase_01 AC 13 ms
12,928 KB
testcase_02 AC 14 ms
12,928 KB
testcase_03 AC 13 ms
12,928 KB
testcase_04 AC 14 ms
12,928 KB
testcase_05 AC 14 ms
12,928 KB
testcase_06 AC 13 ms
12,928 KB
testcase_07 AC 14 ms
12,928 KB
testcase_08 AC 13 ms
12,928 KB
testcase_09 AC 14 ms
12,928 KB
testcase_10 AC 14 ms
12,928 KB
testcase_11 AC 15 ms
12,928 KB
testcase_12 AC 13 ms
12,928 KB
testcase_13 AC 14 ms
12,928 KB
testcase_14 AC 14 ms
12,928 KB
testcase_15 AC 14 ms
12,928 KB
testcase_16 AC 14 ms
12,928 KB
testcase_17 AC 14 ms
12,928 KB
testcase_18 AC 14 ms
12,928 KB
testcase_19 AC 14 ms
12,928 KB
testcase_20 AC 14 ms
12,928 KB
testcase_21 AC 14 ms
12,928 KB
testcase_22 AC 14 ms
12,928 KB
testcase_23 AC 14 ms
12,928 KB
testcase_24 AC 14 ms
12,928 KB
testcase_25 AC 15 ms
12,928 KB
testcase_26 AC 14 ms
12,928 KB
testcase_27 AC 14 ms
12,928 KB
testcase_28 AC 13 ms
12,928 KB
testcase_29 AC 14 ms
12,928 KB
testcase_30 AC 14 ms
12,928 KB
testcase_31 AC 15 ms
12,928 KB
testcase_32 AC 14 ms
12,928 KB
testcase_33 AC 14 ms
12,928 KB
testcase_34 AC 14 ms
12,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)


const ll MOD=998244353;
ll inv[400010],fac[400010],finv[400010];

void fact(){
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(ll i=2;i<400005;i++){
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]* i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}


ll C(ll n,ll k){
	if(!(0<=k && k<=n)) return 0;
	return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j,k;

	ll N,M;
	cin >> N >> M;

	fact();

	ll s=0;
	for(j=1;j<=M;j++){
		s+=C(2*j-2,N-1);
		s%=MOD;
	}


	cout << s << endl;



	return 0;
}
0