結果
問題 | No.1751 Fortune Nim |
ユーザー |
|
提出日時 | 2021-11-20 10:34:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 297 bytes |
コンパイル時間 | 371 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 108,124 KB |
最終ジャッジ日時 | 2025-01-03 02:26:57 |
合計ジャッジ時間 | 5,726 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)