結果
問題 | No.2071 Shift and OR |
ユーザー |
![]() |
提出日時 | 2022-09-18 21:42:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 640 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 100,224 KB |
最終ジャッジ日時 | 2024-12-22 01:40:07 |
合計ジャッジ時間 | 4,420 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
N = int(input())A = list(map(int, input().split()))NM = 1 << 16if N >= 16:print(NM - 1)exit()dp = [0] * NMdp[0] = 1for a in A:dp2 = [0] * NMfor i in range(16):for j in range(NM):dp2[j|a] |= dp[j]a = (a >> 1) | ((a & 1) << 15)dp = dp2for i in reversed(range(NM)):if dp[i] == 1:breakprint(i)