結果
問題 |
No.1444 !Andd
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:29:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 878 bytes |
コンパイル時間 | 428 ms |
コンパイル使用メモリ | 82,332 KB |
実行使用メモリ | 80,276 KB |
最終ジャッジ日時 | 2025-06-12 16:30:07 |
合計ジャッジ時間 | 9,189 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 20 |
ソースコード
n = int(input()) a_list = list(map(int, input().split())) s1 = set() s2 = set() s1.add(1) for a in a_list: new_s1 = set() new_s2 = set() # Process elements from s1 for x in s1: # Multiply option product = x * a if product >= 1024: new_s2.add(product % 1024) else: new_s1.add(product) # AND option new_and = x & a new_s1.add(new_and) # Process elements from s2 for a_prev in s2: # Multiply option if a == 0: new_s1.add(0) else: product_mod = (a_prev * a) % 1024 new_s2.add(product_mod) # AND option new_and = a_prev & a new_s1.add(new_and) # Update s1 and s2 for the next iteration s1 = new_s1 s2 = new_s2 # Output the current count print(len(s1) + len(s2))