結果
問題 |
No.2071 Shift and OR
|
ユーザー |
![]() |
提出日時 | 2022-09-16 22:16:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 562 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 100,736 KB |
最終ジャッジ日時 | 2024-12-21 21:28:46 |
合計ジャッジ時間 | 3,214 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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] xx = x | a z=15 while z: z-=1 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]))