結果

問題 No.2237 Xor Sum Hoge
ユーザー りあんりあん
提出日時 2023-03-03 23:09:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,330 bytes
コンパイル時間 7,692 ms
コンパイル使用メモリ 308,888 KB
実行使用メモリ 5,408 KB
最終ジャッジ日時 2023-10-18 03:29:06
合計ジャッジ時間 11,031 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 247 ms
5,200 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 5 ms
4,348 KB
testcase_11 AC 54 ms
4,348 KB
testcase_12 AC 119 ms
4,348 KB
testcase_13 AC 10 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 56 ms
4,348 KB
testcase_16 AC 238 ms
4,916 KB
testcase_17 AC 225 ms
4,832 KB
testcase_18 WA -
testcase_19 AC 5 ms
4,348 KB
testcase_20 AC 233 ms
4,832 KB
testcase_21 WA -
testcase_22 AC 246 ms
5,324 KB
testcase_23 AC 247 ms
5,188 KB
testcase_24 AC 248 ms
5,352 KB
testcase_25 WA -
testcase_26 AC 246 ms
5,344 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
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) {
        if (dp.empty()) break;
        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