結果

問題 No.2237 Xor Sum Hoge
ユーザー りあんりあん
提出日時 2023-03-03 23:12:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 246 ms / 10,000 ms
コード長 1,305 bytes
コンパイル時間 5,512 ms
コンパイル使用メモリ 308,948 KB
実行使用メモリ 5,324 KB
最終ジャッジ日時 2023-10-18 03:30:45
合計ジャッジ時間 11,084 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 245 ms
5,160 KB
testcase_01 AC 4 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 5 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 54 ms
4,348 KB
testcase_12 AC 118 ms
4,348 KB
testcase_13 AC 203 ms
5,288 KB
testcase_14 AC 119 ms
4,348 KB
testcase_15 AC 56 ms
4,348 KB
testcase_16 AC 236 ms
4,876 KB
testcase_17 AC 223 ms
4,792 KB
testcase_18 AC 113 ms
4,348 KB
testcase_19 AC 105 ms
4,348 KB
testcase_20 AC 234 ms
4,792 KB
testcase_21 AC 245 ms
5,304 KB
testcase_22 AC 243 ms
5,284 KB
testcase_23 AC 245 ms
5,148 KB
testcase_24 AC 246 ms
5,312 KB
testcase_25 AC 245 ms
5,288 KB
testcase_26 AC 245 ms
5,304 KB
testcase_27 AC 242 ms
5,304 KB
testcase_28 AC 243 ms
5,296 KB
testcase_29 AC 243 ms
5,288 KB
testcase_30 AC 245 ms
5,324 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 5 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC target("avx2")
#pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/modint>
#include<atcoder/convolution>
using namespace std;

using P = pair<int, int>;

using mint = atcoder::modint998244353;



int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    long long b, c;
    cin >> n >> b >> c;
    vector<mint> binom(n + 1);
    binom[0] = 1;
    for (int i = 0; i < n; ++i) {
        binom[i + 1] = binom[i] * (n - i) / (i + 1);
    }
    vector<vector<mint>> rbn2(2);
    for (int i = 0; i < (int)binom.size(); ++i) {
        rbn2[i % 2].push_back(binom[i]);
    }
    // reverse(rbn2[0].begin(), rbn2[0].end());
    // reverse(rbn2[1].begin(), rbn2[1].end());


    vector<mint> dp(1);
    dp[0] = 1;
    for (int k = 0; k < 62; ++k) {
        vector<vector<mint>> dp2(2);
        for (int i = 0; i < (int)dp.size(); ++i) {
            dp2[i % 2].push_back(dp[i]);
        }
        int bk = (b >> k) & 1;
        int ck = (c >> k) & 1;
        dp = atcoder::convolution(dp2[bk ^ ck], rbn2[ck]);

        if (bk == 0 && ck == 1) {
            dp.insert(dp.begin(), mint(0));
        }
    }
    if (dp.empty()) {
        cout << 0 << '\n';
    }
    else {
        cout << dp[0].val() << '\n';
    }
    return 0;
}
0