結果
問題 | No.2237 Xor Sum Hoge |
ユーザー |
![]() |
提出日時 | 2023-02-21 14:50:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 519 ms / 10,000 ms |
コード長 | 854 bytes |
コンパイル時間 | 4,525 ms |
コンパイル使用メモリ | 260,332 KB |
最終ジャッジ日時 | 2025-02-10 19:41:38 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h>#include<atcoder/all>using namespace std;using namespace atcoder;using mint = modint998244353;int main(){int n; cin >> n;long long s, x; cin >> s >> x;vector<vector<mint>> f(2,vector<mint>(n+1,0));vector<mint> fact(n+1,1), ifact(n+1,1);for (int i = 2; i <= n; i++) fact[i] = fact[i-1] * i;ifact[n] = fact[n].inv();for (int i = n-1; i >= 2; i--) ifact[i] = ifact[i+1] * (i+1);for (int i = 0; i <= n; i++) f[i&1][i] = fact[n] * ifact[i] * ifact[n-i];vector<mint> cur = {1};for (int d = 0; d < 61; d++){cur = convolution(cur, f[x >> d & 1]);int siz = cur.size();vector<mint> nex((siz+1)/2,0);for (int i = (s >> d & 1); i < siz; i += 2){nex[i/2] = cur[i];}swap(cur,nex);}cout << cur[0].val() << endl;}