結果
問題 |
No.2071 Shift and OR
|
ユーザー |
![]() |
提出日時 | 2022-09-16 22:14:27 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 980 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 101,168 KB |
最終ジャッジ日時 | 2024-12-21 21:17:54 |
合計ジャッジ時間 | 5,482 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 8 |
ソースコード
N=int(input()) A=list(map(int,input().split())) ans = 0 if N>15: 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] | a xx = x z=15 while z: z-=1 x = shift(x) if xx<x: xx = x dp[i+1][j] = max(dp[i+1][j], xx) a = shift(a) print(max(dp[-1]))