結果
| 問題 |
No.2071 Shift and OR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 22:11:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 279 ms / 2,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 340 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 100,864 KB |
| 最終ジャッジ日時 | 2024-12-21 21:09:54 |
| 合計ジャッジ時間 | 7,463 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
N = int(input())
A = list(map(int, input().split()))
if N>=16:
print((1<<16)-1)
exit()
dp = [False]*(1<<16)
dp[0] = True
for Ai in A:
ndp = [False]*(1<<16)
now = Ai
for _ in range(16):
for S in range(1<<16):
ndp[S|now] |= dp[S]
now = (now%2)*(1<<15)+(now//2)
dp = ndp
for i in range((1<<16)-1, -1, -1):
if dp[i]:
print(i)
break