結果
| 問題 |
No.1444 !Andd
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:25:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 975 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 86,616 KB |
| 最終ジャッジ日時 | 2025-06-12 16:26:22 |
| 合計ジャッジ時間 | 17,954 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 20 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
current_states = set()
current_states.add((False, 1)) # Initial state: X=1 (low, lower 10 bits are 1)
for a in A:
next_states = set()
for (h, l) in current_states:
# Multiply operation
if a == 0:
new_h = False
new_l = 0
next_states.add((new_h, new_l))
else:
if h:
new_h = True
new_l = (l * a) % 1024
next_states.add((new_h, new_l))
else:
product = l * a
if product >= 1024:
new_h = True
new_l = product % 1024
else:
new_h = False
new_l = product
next_states.add((new_h, new_l))
# AND operation
new_l_and = l & a
next_states.add((False, new_l_and))
current_states = next_states
print(len(current_states))
gew1fw