結果
| 問題 |
No.1444 !Andd
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-03-26 22:30:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 404 ms / 2,000 ms |
| コード長 | 518 bytes |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 81,908 KB |
| 実行使用メモリ | 78,208 KB |
| 最終ジャッジ日時 | 2024-11-29 00:06:52 |
| 合計ジャッジ時間 | 6,321 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
n = int(input())
*a, = map(int,input().split())
M = 1024
dp = [0]*(2*M)
dp[1] = 1
for ai in a:
if ai == 0:
dp = [0]*(2*M)
dp[0] = 1
print(1)
continue
ndp = [0]*(2*M)
for i in range(M):
if dp[i]==0: continue
ndp[i&ai] |= 1
if i*ai < M:
ndp[i*ai] |= 1
else:
ndp[M+(i*ai)%M] += 1
for i in range(M,2*M):
if dp[i]:
ndp[M+(i*ai)%M] += dp[i]
ndp[i&ai] |= 1
dp = ndp
print(sum(dp))
convexineq