結果

問題 No.2237 Xor Sum Hoge
ユーザー 👑 hitonanodehitonanode
提出日時 2023-03-11 12:59:39
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,015 ms / 10,000 ms
コード長 1,141 bytes
コンパイル時間 2,723 ms
コンパイル使用メモリ 142,924 KB
実行使用メモリ 7,648 KB
最終ジャッジ日時 2023-10-18 09:49:41
合計ジャッジ時間 20,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,006 ms
7,648 KB
testcase_01 AC 4 ms
4,348 KB
testcase_02 AC 5 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 7 ms
4,348 KB
testcase_05 AC 13 ms
4,348 KB
testcase_06 AC 7 ms
4,348 KB
testcase_07 AC 8 ms
4,348 KB
testcase_08 AC 8 ms
4,348 KB
testcase_09 AC 8 ms
4,348 KB
testcase_10 AC 13 ms
4,348 KB
testcase_11 AC 110 ms
4,348 KB
testcase_12 AC 481 ms
5,428 KB
testcase_13 AC 1,004 ms
7,572 KB
testcase_14 AC 489 ms
5,508 KB
testcase_15 AC 227 ms
4,492 KB
testcase_16 AC 480 ms
5,684 KB
testcase_17 AC 491 ms
5,720 KB
testcase_18 AC 232 ms
4,544 KB
testcase_19 AC 232 ms
4,532 KB
testcase_20 AC 489 ms
5,628 KB
testcase_21 AC 1,003 ms
7,584 KB
testcase_22 AC 1,004 ms
7,544 KB
testcase_23 AC 1,007 ms
7,632 KB
testcase_24 AC 1,011 ms
7,624 KB
testcase_25 AC 1,003 ms
7,548 KB
testcase_26 AC 1,003 ms
7,584 KB
testcase_27 AC 999 ms
7,592 KB
testcase_28 AC 1,007 ms
7,568 KB
testcase_29 AC 1,008 ms
7,544 KB
testcase_30 AC 1,015 ms
7,644 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 14 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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

int main() {
    int N;
    long long B, C;
    cin >> N >> B >> C;

    const int sz = N * 2;
    vector<mint> carry_rev(sz);
    carry_rev.back() = 1;

    vector<mint> trans_even(N + 1), trans_odd(N + 1);
    mint num = 1, den = 1;
    REP(i, N + 1) {
        (i % 2 ? trans_odd : trans_even).at(i) = num / den;
        num *= N - i, den *= i + 1;
    }

    IREP(d, 60) {
        IREP(i, sz) carry_rev.at(sz - 1 - i) = i % 2 ? 0 : carry_rev.at(sz - 1 - i / 2);

        if ((B >> d) & 1) {
            carry_rev.push_back(0);
            carry_rev.erase(carry_rev.begin());
        }

        carry_rev = atcoder::convolution(carry_rev, (C >> d) % 2 ? trans_odd : trans_even);
        carry_rev.resize(sz);
    }

    cout << carry_rev.back().val() << '\n';
}
0