結果
| 問題 |
No.2071 Shift and OR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 23:45:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 457 bytes |
| コンパイル時間 | 696 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 30,592 KB |
| 最終ジャッジ日時 | 2024-12-21 23:25:09 |
| 合計ジャッジ時間 | 64,028 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 TLE * 9 |
ソースコード
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)