結果

問題 No.3349 AtCoder Janken Train
コンテスト
ユーザー ponjuice
提出日時 2025-11-01 03:06:32
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 4,241 ms
コンパイル使用メモリ 314,664 KB
実行使用メモリ 10,468 KB
最終ジャッジ日時 2025-11-13 21:10:55
合計ジャッジ時間 5,963 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/convolution>
using namespace std;
using ll = long long;

const ll MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    if (!(cin >> n >> m)) return 0;

    vector<ll> f = {1, 1};
    for (int iter = 0; iter < n; ++iter) {
        vector<ll> fy = f;
        fy[0] = 0;
        f = atcoder::convolution(f, fy);
        f[0] = 1;
    }

    ll ans = f[(1<<n) - m] % MOD;
    for (int i = 1; i <= m; ++i) ans = ans * i % MOD;
    for (int i = 1; i <= (1<<n) - m; ++i) ans = ans * i % MOD;

    cout << ans % MOD << endl;
    return 0;
}
0