結果
| 問題 | No.1751 Fortune Nim |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-20 10:34:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 81 ms / 2,000 ms |
| コード長 | 297 bytes |
| 記録 | |
| コンパイル時間 | 676 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 108,800 KB |
| 最終ジャッジ日時 | 2026-06-06 10:39:28 |
| 合計ジャッジ時間 | 5,629 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
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)