結果
問題 | No.1741 Arrays and XOR Procedure |
ユーザー |
![]() |
提出日時 | 2021-11-12 21:30:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 183 ms / 2,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 82,256 KB |
実行使用メモリ | 111,316 KB |
最終ジャッジ日時 | 2024-11-25 12:11:51 |
合計ジャッジ時間 | 6,484 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
def lucas(n,k):while max(n,k):if n&1==0 and k&1==1:return 0n>>=1k>>=1return 1N=int(input())B=list(map(int,input().split()))DP=[[0,0] for i in range(N+1)]DP[0][0]=1mod=998244353for 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])%modprint(DP[N][1])