結果
| 問題 |
No.1741 Arrays and XOR Procedure
|
| コンテスト | |
| ユーザー |
dn6049949
|
| 提出日時 | 2021-11-14 22:29:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 120 ms / 2,000 ms |
| コード長 | 996 bytes |
| コンパイル時間 | 252 ms |
| コンパイル使用メモリ | 82,240 KB |
| 実行使用メモリ | 94,192 KB |
| 最終ジャッジ日時 | 2024-11-30 08:13:41 |
| 合計ジャッジ時間 | 5,968 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def IR(n):
return [I() for _ in range(n)]
def LIR(n):
return [LI() for _ in range(n)]
sys.setrecursionlimit(1000000)
mod = 998244353
def main():
def lucas(a,b):
return 1*(a&b == b)
n = I()
b = LI()
c = [lucas(n-1,i) for i in range(n)]
dp = [0]*2
dp[0] = 1
for bi,ci in zip(b,c):
ndp = [0]*2
for j in range(2):
for i in range(2):
if bi >= 0 and bi != i:
continue
if ci:
nj = j^i
else:
nj = j
ndp[nj] = (ndp[nj]+dp[j])%mod
dp = ndp
print(dp[1])
return
if __name__ == "__main__":
main()
dn6049949