結果

問題 No.1741 Arrays and XOR Procedure
ユーザー mkawa2mkawa2
提出日時 2021-11-12 23:10:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 1,105 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 118,620 KB
最終ジャッジ日時 2023-08-17 03:40:07
合計ジャッジ時間 6,545 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,100 KB
testcase_01 AC 73 ms
71,384 KB
testcase_02 AC 73 ms
71,300 KB
testcase_03 AC 126 ms
118,620 KB
testcase_04 AC 71 ms
71,488 KB
testcase_05 AC 128 ms
118,260 KB
testcase_06 AC 130 ms
118,344 KB
testcase_07 AC 130 ms
118,208 KB
testcase_08 AC 128 ms
118,440 KB
testcase_09 AC 120 ms
113,208 KB
testcase_10 AC 121 ms
113,176 KB
testcase_11 AC 115 ms
104,880 KB
testcase_12 AC 107 ms
98,024 KB
testcase_13 AC 125 ms
112,988 KB
testcase_14 AC 109 ms
101,156 KB
testcase_15 AC 114 ms
108,760 KB
testcase_16 AC 85 ms
76,732 KB
testcase_17 AC 95 ms
87,032 KB
testcase_18 AC 111 ms
101,348 KB
testcase_19 AC 83 ms
76,812 KB
testcase_20 AC 124 ms
118,104 KB
testcase_21 AC 114 ms
108,440 KB
testcase_22 AC 109 ms
104,584 KB
testcase_23 AC 90 ms
85,456 KB
testcase_24 AC 83 ms
76,796 KB
testcase_25 AC 123 ms
117,972 KB
testcase_26 AC 96 ms
90,500 KB
testcase_27 AC 85 ms
76,720 KB
testcase_28 AC 113 ms
104,708 KB
testcase_29 AC 118 ms
108,724 KB
testcase_30 AC 113 ms
104,668 KB
testcase_31 AC 84 ms
76,700 KB
testcase_32 AC 96 ms
90,716 KB
testcase_33 AC 101 ms
95,304 KB
testcase_34 AC 87 ms
81,860 KB
testcase_35 AC 74 ms
71,440 KB
testcase_36 AC 81 ms
77,088 KB
testcase_37 AC 99 ms
90,748 KB
testcase_38 AC 128 ms
118,180 KB
testcase_39 AC 96 ms
88,888 KB
testcase_40 AC 82 ms
76,756 KB
testcase_41 AC 88 ms
81,004 KB
testcase_42 AC 85 ms
76,732 KB
testcase_43 AC 75 ms
71,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = 18446744073709551615
inf = 4294967295
# md = 10**9+7
md = 998244353

def nCr(n, r):
    n ^= mask
    if n & r: return 0
    return 1

mask = (1 << 18)-1
n = II()
bb = LI()
cc = []
for i in range(n):
    cc.append(nCr(n-1, i))
# print(cc)

cnt = [0, 0]
for b, c in zip(bb, cc):
    if b == -1: cnt[c] += 1

if cnt[1] == 0:
    x = 0
    for b, c in zip(bb, cc):
        if b == -1: continue
        x ^= b*c
    if x == 1: ans = pow(2, cnt[0], md)
    else: ans = 0

else:
    ans = pow(2, cnt[0]+cnt[1]-1, md)

print(ans)
0