結果
| 問題 | No.2071 Shift and OR | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-09-17 21:14:58 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 95 ms / 2,000 ms | 
| コード長 | 452 bytes | 
| コンパイル時間 | 195 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 100,480 KB | 
| 最終ジャッジ日時 | 2024-12-22 00:59:17 | 
| 合計ジャッジ時間 | 4,059 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
N = int(input())
A = list(map(int,input().split()))
import sys
if N >= 15:
    print((1 << 16) - 1)
    exit()
C = 1 << 16
def shift(x):
    return (x >> 1) + (x & 1) * (1 << 15)
dp = [0] * C
dp[0] = 1
for a in A:
    nx = [0] * C
    for i in range(C):
        if dp[i]:
            for _ in range(16):
                nx[i | a] = 1
                a = shift(a)
    dp = nx
for i in range(C - 1,-1,-1):
    if dp[i]:
        print(i)
        exit()
            
            
            
        