結果
| 問題 | No.2071 Shift and OR |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 23:45:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 297 ms / 2,000 ms |
| コード長 | 457 bytes |
| 記録 | |
| コンパイル時間 | 587 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 100,480 KB |
| 最終ジャッジ日時 | 2024-12-21 23:25:17 |
| 合計ジャッジ時間 | 7,615 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
ans = 0
if N >= 16:
print(2**16 - 1)
exit()
def shift(x):
return x // 2 + pow(2, 15) * (x % 2)
M = 1 << 16
dp = [False] * M
dp[0] = True
for a in A:
ndp = [False] * M
now = a
for _ in range(16):
for s in range(M):
ndp[s | now] |= dp[s]
now = shift(now)
dp = ndp[:]
ans = 0
for i in range(M):
if dp[i]:
ans = max(ans, i)
print(ans)