結果
問題 |
No.2071 Shift and OR
|
ユーザー |
![]() |
提出日時 | 2022-09-16 22:24:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 332 ms |
コンパイル使用メモリ | 82,392 KB |
実行使用メモリ | 183,436 KB |
最終ジャッジ日時 | 2024-12-21 21:38:21 |
合計ジャッジ時間 | 16,185 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 8 TLE * 3 |
ソースコード
N=int(input()) A=list(map(int,input().split())) 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]))