結果

問題 No.1751 Fortune Nim
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-20 10:34:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 111,240 KB
最終ジャッジ日時 2023-08-31 01:11:23
合計ジャッジ時間 7,738 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
71,300 KB
testcase_01 AC 58 ms
71,404 KB
testcase_02 AC 57 ms
71,292 KB
testcase_03 AC 57 ms
71,448 KB
testcase_04 AC 56 ms
71,472 KB
testcase_05 AC 55 ms
71,416 KB
testcase_06 AC 59 ms
71,416 KB
testcase_07 AC 59 ms
71,384 KB
testcase_08 AC 92 ms
98,968 KB
testcase_09 AC 86 ms
98,744 KB
testcase_10 AC 81 ms
93,888 KB
testcase_11 AC 106 ms
111,240 KB
testcase_12 AC 96 ms
93,304 KB
testcase_13 AC 100 ms
99,824 KB
testcase_14 AC 88 ms
96,332 KB
testcase_15 AC 88 ms
98,616 KB
testcase_16 AC 92 ms
102,128 KB
testcase_17 AC 85 ms
96,440 KB
testcase_18 AC 103 ms
99,788 KB
testcase_19 AC 86 ms
96,028 KB
testcase_20 AC 106 ms
99,900 KB
testcase_21 AC 88 ms
99,288 KB
testcase_22 AC 105 ms
100,260 KB
testcase_23 AC 98 ms
104,608 KB
testcase_24 AC 111 ms
100,628 KB
testcase_25 AC 110 ms
100,548 KB
testcase_26 AC 110 ms
100,380 KB
testcase_27 AC 108 ms
100,784 KB
testcase_28 AC 106 ms
100,636 KB
testcase_29 AC 106 ms
100,396 KB
testcase_30 AC 108 ms
100,380 KB
testcase_31 AC 107 ms
100,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
mod = 998244353

inv3 = -1*pow(3,mod-2,mod)%mod

num = 0
for a in A:
    num ^= a

t = sum(A)
if num:
    cand = 10**20
    for a in A:
        cand = min(cand,(a^num)-a)
    t += cand+1
ans = (1-pow(inv3,t,mod))*pow(2,mod-2,mod)%mod
print(ans)
0