結果

問題 No.2511 Mountain Sequence
ユーザー MaiMai
提出日時 2023-11-02 16:11:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,265 bytes
コンパイル時間 1,634 ms
コンパイル使用メモリ 168,060 KB
実行使用メモリ 19,488 KB
最終ジャッジ日時 2023-11-02 16:11:37
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// i_love_aisukiuwu
#include <bits/stdc++.h>
#include <vector>
using namespace std;

#define ll long long
#define all(a) (a).begin(), (a).end()
#define vi vector<ll>
#define pi pair<ll, ll>
#define fi first
#define se second
#define gcd __gcd
#define mset(a, v) memset(a, v, sizeof(a))
#define endl '\n'

const int N = 1e6 + 5, LOG = 27, MOD = 998244353;
const ll INF = 1e18;

void process();

signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  process();
  cerr << endl << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

ll fact[N], inv[N];
ll bp(ll n, ll k) {
  ll res = 1;
  while (k > 0) {
    if (k & 1)
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}
void pre() {
  fact[0] = 1;
  for (ll i = 1; i < N; ++i)
    fact[i] = (fact[i - 1] * i) % MOD;
  inv[N - 1] = bp(fact[N - 1], MOD - 2);
  for (ll i = N - 2; i >= 0; --i)
    inv[i] = (inv[i + 1] * (i + 1)) % MOD;
}
ll n, m;
void process() {
  auto C = [&](ll n, ll k) -> ll {
    if (n < 0 || k < 0 || n < k)
      return 0;
    return fact[n] * inv[k] % MOD * inv[n - k] % MOD;
  };
  pre();
  cin >> n >> m;
  ll res = 0;
  for (ll i = 1; i <= m; ++i)
    res = (res + C(2 * i - 2, n - 1)) % MOD;
  cout << res << endl;
}
0