結果
| 問題 | No.1444 !Andd |
| ユーザー |
convexineq
|
| 提出日時 | 2021-03-26 22:30:13 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 180 ms / 2,000 ms |
| + 248µs | |
| コード長 | 518 bytes |
| 記録 | |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 63,872 KB |
| 実行使用メモリ | 64,636 KB |
| 最終ジャッジ日時 | 2026-10-25 12:57:55 |
| 合計ジャッジ時間 | 4,528 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
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