結果
問題 | No.2071 Shift and OR |
ユーザー |
![]() |
提出日時 | 2023-02-24 07:23:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 460 bytes |
コンパイル時間 | 401 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,280 KB |
最終ジャッジ日時 | 2024-07-23 22:06:15 |
合計ジャッジ時間 | 9,624 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | TLE * 1 -- * 36 |
ソースコード
import sys readline=sys.stdin.readline import heapq N=int(readline()) A=list(map(int,readline().split())) if N>=16: ans=(1<<16)-1 else: dp=[False]*(1<<16) dp[0]=True for a in A: prev=dp dp=[False]*(1<<16) for bit in range(1<<16): for i in range(16): dp[bit|a]|=prev[bit] a=a>>1|(a&1)<<15 for ans in range((1<<16)-1,-1,-1): if dp[ans]: break print(ans)