結果

問題 No.2904 Distinct Multisets in a Way
ユーザー i_am_noob
提出日時 2025-07-04 03:16:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 399 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 3,782 ms
コンパイル使用メモリ 233,076 KB
実行使用メモリ 39,148 KB
最終ジャッジ日時 2025-07-04 03:16:57
合計ジャッジ時間 9,225 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())

#include<atcoder/convolution>
using namespace atcoder;
using mint=modint998244353;

void amano_hina_is_the_goat(){
    int n; cin >> n;
    vector<mint> vec={1,1,1},res={1};
    for(int i=n; i; i>>=1,vec=convolution(vec,vec)) if(i&1) res=convolution(res,vec);
    mint ans=(res[n]-1)/2;
    cout << ans.val() << "\n";
}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cout << fixed << setprecision(20);
    int t=1; //cin >> t;
    while(t--) amano_hina_is_the_goat();
}
0