結果

問題 No.2237 Xor Sum Hoge
ユーザー t98slidert98slider
提出日時 2023-03-04 05:33:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 809 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 95,940 KB
最終ジャッジ日時 2024-04-27 04:32:11
合計ジャッジ時間 1,126 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:10: error: incomplete type 'std::ios' {aka 'std::basic_ios<char>'} used in nested name specifier
    7 |     ios::sync_with_stdio(false);
      |          ^~~~~~~~~~~~~~~
main.cpp:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
main.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include <atcoder/all>
  +++ |+#include <iostream>
    2 | using namespace std;
main.cpp:26:5: error: 'cout' was not declared in this scope
   26 |     cout << dp[0].val() << '\n';
      |     ^~~~
main.cpp:26:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    long long B, C;
    cin >> N >> B >> C;

    vector<mint> fact(N + 1), inv(N + 1), dp = {1};
    vector<vector<mint>> coef(2, vector<mint>(N + 1));
    fact[0] = 1;
    for(int i = 1; i <= N; i++) fact[i] = i * fact[i - 1];
    inv[N] = 1 / fact[N];
    for(int i = N; i >= 1; i--) inv[i - 1] = i * inv[i];
    for(int i = 0; i <= N; i++) coef[i & 1][i] = fact[N] * inv[N - i] * inv[i];

    for(int i = 0; i < 60; i++){
        auto tmp = convolution(dp, coef[C >> i & 1]);
        dp.resize((tmp.size() + 1) / 2);
        for(int j = B >> i & 1; j < tmp.size(); j += 2) dp[j >> 1] = tmp[j];
    }
    cout << dp[0].val() << '\n';
}
0