結果
| 問題 |
No.2071 Shift and OR
|
| コンテスト | |
| ユーザー |
ikoma
|
| 提出日時 | 2022-09-16 22:22:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 526 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 82,288 KB |
| 実行使用メモリ | 101,760 KB |
| 最終ジャッジ日時 | 2024-12-21 21:37:12 |
| 合計ジャッジ時間 | 3,336 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 8 |
ソースコード
N=int(input())
A=list(map(int,input().split()))
ans = 0
if N>20:
print(2**16-1)
exit()
ans = 0
def shift(x):
return (x>>1) + (1<<15) * (x&1)
dp = [[0]*16 for _ in range(N+1)]
for i in range(N):
a = A[i]
for j in range(16):
for k in range(16):
x = dp[i][k]
xx = x | a
for _ in range(16):
x = shift(x)
if xx<x|a:
xx = x|a
dp[i+1][j] = max(dp[i+1][j], xx)
a = shift(a)
print(max(dp[-1]))
ikoma