結果

問題 No.1741 Arrays and XOR Procedure
ユーザー gr1msl3ygr1msl3y
提出日時 2021-11-12 23:00:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 106,940 KB
最終ジャッジ日時 2023-08-17 03:28:47
合計ジャッジ時間 7,923 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,464 KB
testcase_01 AC 79 ms
71,264 KB
testcase_02 AC 78 ms
71,408 KB
testcase_03 AC 150 ms
106,940 KB
testcase_04 AC 78 ms
71,128 KB
testcase_05 AC 146 ms
106,492 KB
testcase_06 AC 157 ms
106,708 KB
testcase_07 AC 155 ms
106,600 KB
testcase_08 AC 150 ms
106,336 KB
testcase_09 AC 142 ms
102,900 KB
testcase_10 AC 141 ms
102,852 KB
testcase_11 AC 134 ms
96,948 KB
testcase_12 AC 124 ms
92,072 KB
testcase_13 AC 146 ms
103,032 KB
testcase_14 AC 126 ms
94,392 KB
testcase_15 AC 140 ms
99,680 KB
testcase_16 AC 95 ms
76,504 KB
testcase_17 AC 112 ms
84,144 KB
testcase_18 AC 132 ms
94,412 KB
testcase_19 AC 91 ms
76,560 KB
testcase_20 AC 151 ms
106,888 KB
testcase_21 AC 137 ms
99,796 KB
testcase_22 AC 132 ms
96,784 KB
testcase_23 AC 109 ms
82,916 KB
testcase_24 AC 96 ms
77,076 KB
testcase_25 AC 148 ms
106,352 KB
testcase_26 AC 116 ms
87,104 KB
testcase_27 AC 93 ms
76,564 KB
testcase_28 AC 131 ms
97,036 KB
testcase_29 AC 140 ms
99,884 KB
testcase_30 AC 136 ms
96,904 KB
testcase_31 AC 96 ms
76,604 KB
testcase_32 AC 118 ms
86,984 KB
testcase_33 AC 119 ms
90,292 KB
testcase_34 AC 103 ms
80,624 KB
testcase_35 AC 82 ms
75,308 KB
testcase_36 AC 94 ms
77,416 KB
testcase_37 AC 114 ms
87,068 KB
testcase_38 AC 150 ms
106,220 KB
testcase_39 AC 114 ms
85,716 KB
testcase_40 AC 90 ms
76,624 KB
testcase_41 AC 103 ms
80,160 KB
testcase_42 AC 93 ms
76,592 KB
testcase_43 AC 78 ms
71,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
B = list(map(int, input().split()))
MOD = 998244353


def ord2(n):
    i = 0
    while not n % 2:
        i += 1
        n >>= 1
    return i


comb = [0]*N
for i in range(1, N):
    comb[i] = comb[i-1]+ord2(N-i)-ord2(i)

cta = 0
ctb = 0
v = 0
for i in range(N):
    if not comb[i]:
        if B[i] == -1:
            cta += 1
        else:
            v ^= B[i]
    else:
        if B[i] == -1:
            ctb += 1

if v == cta == 0:
    print(0)
else:
    print(pow(2, ctb+max(0, cta-1), MOD))
0