結果

問題 No.1751 Fortune Nim
ユーザー Eki1009Eki1009
提出日時 2021-11-19 23:13:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 111,228 KB
最終ジャッジ日時 2023-08-30 10:23:32
合計ジャッジ時間 5,653 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,244 KB
testcase_01 AC 70 ms
71,348 KB
testcase_02 AC 70 ms
71,296 KB
testcase_03 AC 70 ms
71,344 KB
testcase_04 AC 70 ms
71,364 KB
testcase_05 AC 70 ms
71,384 KB
testcase_06 AC 70 ms
71,188 KB
testcase_07 AC 71 ms
71,276 KB
testcase_08 AC 109 ms
99,020 KB
testcase_09 AC 105 ms
98,336 KB
testcase_10 AC 100 ms
93,724 KB
testcase_11 AC 120 ms
111,228 KB
testcase_12 AC 99 ms
93,432 KB
testcase_13 AC 120 ms
99,736 KB
testcase_14 AC 104 ms
96,328 KB
testcase_15 AC 107 ms
98,444 KB
testcase_16 AC 111 ms
102,128 KB
testcase_17 AC 101 ms
96,436 KB
testcase_18 AC 119 ms
99,888 KB
testcase_19 AC 101 ms
96,016 KB
testcase_20 AC 121 ms
99,952 KB
testcase_21 AC 103 ms
99,056 KB
testcase_22 AC 121 ms
99,876 KB
testcase_23 AC 114 ms
104,444 KB
testcase_24 AC 125 ms
100,428 KB
testcase_25 AC 128 ms
100,480 KB
testcase_26 AC 128 ms
100,436 KB
testcase_27 AC 128 ms
100,424 KB
testcase_28 AC 124 ms
100,568 KB
testcase_29 AC 121 ms
100,544 KB
testcase_30 AC 122 ms
100,428 KB
testcase_31 AC 124 ms
100,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
n = int(input())
A = list(map(int,input().split()))
x = 0
for a in A:
    x ^= a
t = sum(A)
m = 0
for a in A:
    if x^a < a:
        m = max(m,a-(x^a))
t -= m
if x:
    t += 1
ans = (1-pow(pow(-3,mod-2,mod),t,mod))*(mod+1)//2%mod
print(ans)
0