結果
| 問題 | No.2071 Shift and OR |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 22:11:43 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 162 ms / 2,000 ms |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 100,992 KB |
| 最終ジャッジ日時 | 2026-05-28 10:10:10 |
| 合計ジャッジ時間 | 4,977 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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