結果

問題 No.1741 Arrays and XOR Procedure
ユーザー 👑 rin204rin204
提出日時 2022-01-23 07:59:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 105,404 KB
最終ジャッジ日時 2023-08-19 11:06:36
合計ジャッジ時間 8,231 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,420 KB
testcase_01 AC 68 ms
71,420 KB
testcase_02 AC 70 ms
71,104 KB
testcase_03 AC 125 ms
104,968 KB
testcase_04 AC 74 ms
71,248 KB
testcase_05 AC 120 ms
104,924 KB
testcase_06 AC 128 ms
105,220 KB
testcase_07 AC 129 ms
105,404 KB
testcase_08 AC 122 ms
104,844 KB
testcase_09 AC 120 ms
101,908 KB
testcase_10 AC 116 ms
101,564 KB
testcase_11 AC 112 ms
96,056 KB
testcase_12 AC 108 ms
91,604 KB
testcase_13 AC 117 ms
101,300 KB
testcase_14 AC 107 ms
93,352 KB
testcase_15 AC 113 ms
98,568 KB
testcase_16 AC 84 ms
76,680 KB
testcase_17 AC 94 ms
83,448 KB
testcase_18 AC 109 ms
93,372 KB
testcase_19 AC 82 ms
76,552 KB
testcase_20 AC 126 ms
105,176 KB
testcase_21 AC 110 ms
98,076 KB
testcase_22 AC 112 ms
95,720 KB
testcase_23 AC 94 ms
82,516 KB
testcase_24 AC 87 ms
76,748 KB
testcase_25 AC 123 ms
105,128 KB
testcase_26 AC 96 ms
86,180 KB
testcase_27 AC 84 ms
76,660 KB
testcase_28 AC 113 ms
96,108 KB
testcase_29 AC 113 ms
98,720 KB
testcase_30 AC 111 ms
95,912 KB
testcase_31 AC 81 ms
76,840 KB
testcase_32 AC 99 ms
86,284 KB
testcase_33 AC 102 ms
89,540 KB
testcase_34 AC 90 ms
80,096 KB
testcase_35 AC 71 ms
71,228 KB
testcase_36 AC 83 ms
77,136 KB
testcase_37 AC 95 ms
86,064 KB
testcase_38 AC 125 ms
105,092 KB
testcase_39 AC 99 ms
84,996 KB
testcase_40 AC 80 ms
76,656 KB
testcase_41 AC 90 ms
79,476 KB
testcase_42 AC 86 ms
76,768 KB
testcase_43 AC 69 ms
71,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
B = list(map(int, input().split()))
bi = 0
x = 0
odd = 0
even = 0
for i in range(n):
    if B[i] == -1:
        if bi == 0:
            odd += 1
        else:
            even += 1
    else:
        if bi == 0:
            x ^= B[i]
    if i == n - 1:
        break
    y = n - i - 1
    while y % 2 == 0:
        y //= 2
        bi += 1
    y = i + 1
    while y % 2 == 0:
        y //= 2
        bi -= 1

if odd > 0:
    print(pow(2, odd + even - 1, MOD))
elif x == 0:
    print(0)
else:
    print(pow(2, even, MOD))

    
0