結果

問題 No.1751 Fortune Nim
ユーザー torisasami4torisasami4
提出日時 2021-11-04 04:23:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 6,143 ms
コンパイル使用メモリ 260,352 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 06:29:01
合計ジャッジ時間 7,504 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 53 ms
4,376 KB
testcase_09 AC 50 ms
4,380 KB
testcase_10 AC 43 ms
4,376 KB
testcase_11 AC 65 ms
4,380 KB
testcase_12 AC 40 ms
4,376 KB
testcase_13 AC 65 ms
4,380 KB
testcase_14 AC 49 ms
4,376 KB
testcase_15 AC 50 ms
4,376 KB
testcase_16 AC 58 ms
4,376 KB
testcase_17 AC 49 ms
4,380 KB
testcase_18 AC 65 ms
4,380 KB
testcase_19 AC 46 ms
4,380 KB
testcase_20 AC 71 ms
4,376 KB
testcase_21 AC 55 ms
4,380 KB
testcase_22 AC 73 ms
4,380 KB
testcase_23 AC 62 ms
4,376 KB
testcase_24 AC 74 ms
4,380 KB
testcase_25 AC 75 ms
4,380 KB
testcase_26 AC 74 ms
4,376 KB
testcase_27 AC 74 ms
4,376 KB
testcase_28 AC 74 ms
4,376 KB
testcase_29 AC 74 ms
4,376 KB
testcase_30 AC 74 ms
4,376 KB
testcase_31 AC 74 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;

#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    long long sum = 0;
    int x = 0;
    rep(i, n) sum += a[i], x ^= a[i];
    long long t;
    if(x != 0) {
        int m = 2e9;
        rep(i, n) m = min(m, (a[i] ^ x) - a[i]);
        t = sum + m + 1;
    }
    else
        t = sum;
    cout << (((mint)1 - ((mint)(-1) / 3).pow(t)) / 2).val() << endl;
}
0