結果

問題 No.1741 Arrays and XOR Procedure
ユーザー googol_S0googol_S0
提出日時 2021-11-12 21:30:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 109,856 KB
最終ジャッジ日時 2023-08-16 21:38:35
合計ジャッジ時間 10,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,892 KB
testcase_01 AC 72 ms
70,832 KB
testcase_02 AC 75 ms
70,324 KB
testcase_03 AC 258 ms
109,512 KB
testcase_04 AC 71 ms
70,436 KB
testcase_05 AC 196 ms
109,672 KB
testcase_06 AC 229 ms
109,856 KB
testcase_07 AC 232 ms
109,720 KB
testcase_08 AC 203 ms
109,764 KB
testcase_09 AC 209 ms
106,924 KB
testcase_10 AC 210 ms
106,864 KB
testcase_11 AC 184 ms
102,568 KB
testcase_12 AC 167 ms
99,112 KB
testcase_13 AC 206 ms
107,472 KB
testcase_14 AC 175 ms
100,988 KB
testcase_15 AC 192 ms
104,760 KB
testcase_16 AC 104 ms
78,284 KB
testcase_17 AC 135 ms
89,116 KB
testcase_18 AC 180 ms
100,632 KB
testcase_19 AC 108 ms
77,544 KB
testcase_20 AC 206 ms
109,848 KB
testcase_21 AC 185 ms
104,772 KB
testcase_22 AC 178 ms
102,500 KB
testcase_23 AC 137 ms
87,180 KB
testcase_24 AC 103 ms
78,284 KB
testcase_25 AC 208 ms
109,696 KB
testcase_26 AC 146 ms
93,480 KB
testcase_27 AC 111 ms
78,360 KB
testcase_28 AC 192 ms
102,280 KB
testcase_29 AC 198 ms
104,688 KB
testcase_30 AC 180 ms
102,268 KB
testcase_31 AC 105 ms
77,644 KB
testcase_32 AC 147 ms
93,292 KB
testcase_33 AC 159 ms
97,588 KB
testcase_34 AC 124 ms
84,064 KB
testcase_35 AC 98 ms
76,032 KB
testcase_36 AC 105 ms
78,908 KB
testcase_37 AC 145 ms
92,764 KB
testcase_38 AC 217 ms
109,768 KB
testcase_39 AC 141 ms
90,732 KB
testcase_40 AC 108 ms
77,204 KB
testcase_41 AC 120 ms
83,096 KB
testcase_42 AC 108 ms
77,892 KB
testcase_43 AC 72 ms
70,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def lucas(n,k):
  while max(n,k):
    if n&1==0 and k&1==1:
      return 0
    n>>=1
    k>>=1
  return 1

N=int(input())
B=list(map(int,input().split()))
DP=[[0,0] for i in range(N+1)]
DP[0][0]=1
mod=998244353
for i in range(N):
  for j in range(2):
    for k in range(2):
      if B[i]==k or B[i]==-1:
        x=lucas(N-1,i)
        DP[i+1][j^(k*x)]=(DP[i+1][j^(k*x)]+DP[i][j])%mod
print(DP[N][1])
0