結果

問題 No.1741 Arrays and XOR Procedure
ユーザー titiatitia
提出日時 2022-06-14 05:26:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,924 KB
最終ジャッジ日時 2024-04-09 20:47:06
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 26 ms
10,880 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 145 ms
23,924 KB
testcase_04 AC 28 ms
10,624 KB
testcase_05 AC 111 ms
14,640 KB
testcase_06 AC 132 ms
19,212 KB
testcase_07 AC 136 ms
19,220 KB
testcase_08 AC 112 ms
14,772 KB
testcase_09 AC 118 ms
16,924 KB
testcase_10 AC 115 ms
16,412 KB
testcase_11 AC 95 ms
15,720 KB
testcase_12 AC 81 ms
14,368 KB
testcase_13 AC 113 ms
16,272 KB
testcase_14 AC 89 ms
14,764 KB
testcase_15 AC 108 ms
16,032 KB
testcase_16 AC 30 ms
11,008 KB
testcase_17 AC 57 ms
12,672 KB
testcase_18 AC 96 ms
15,072 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 126 ms
17,516 KB
testcase_21 AC 100 ms
15,552 KB
testcase_22 AC 90 ms
15,112 KB
testcase_23 AC 52 ms
12,416 KB
testcase_24 AC 33 ms
11,136 KB
testcase_25 AC 123 ms
17,640 KB
testcase_26 AC 69 ms
13,568 KB
testcase_27 AC 32 ms
10,880 KB
testcase_28 AC 99 ms
15,336 KB
testcase_29 AC 107 ms
15,988 KB
testcase_30 AC 98 ms
15,348 KB
testcase_31 AC 31 ms
11,008 KB
testcase_32 AC 67 ms
13,568 KB
testcase_33 AC 77 ms
14,136 KB
testcase_34 AC 46 ms
11,896 KB
testcase_35 AC 27 ms
10,624 KB
testcase_36 AC 36 ms
11,264 KB
testcase_37 AC 64 ms
13,440 KB
testcase_38 AC 122 ms
16,904 KB
testcase_39 AC 64 ms
12,800 KB
testcase_40 AC 27 ms
10,624 KB
testcase_41 AC 47 ms
11,776 KB
testcase_42 AC 31 ms
10,880 KB
testcase_43 AC 28 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

mod=998244353

ONE1=0
ONEm1=0
ZEROm1=0

for i in range(N):
    if ((N-1)&i)==i: # N-1 C iの偶奇が奇数のときをこれで判定できる
        if B[i]==1:
            ONE1+=1
        elif B[i]==-1:
            ONEm1+=1
    else:
        if B[i]==-1:
            ZEROm1+=1
        


ANS=pow(2,ZEROm1,mod)

if ONEm1==0:
    if ONE1%2==1:
        ANS2=1
    else:
        ANS2=0
else:
    ANS2=pow(2,ONEm1,mod)*pow(2,mod-2,mod)

print(ANS*ANS2%mod)
        
0