結果

問題 No.2071 Shift and OR
ユーザー ytft
提出日時 2022-09-22 15:46:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 100,096 KB
最終ジャッジ日時 2024-12-22 04:54:09
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda:sys.stdin.readline().rstrip()
N=int(input())
A=list(map(int,input().split()))
if N>15:
	print(2**16-1)
else:
	pos=[i==0 for i in range(2**16)]
	for i in A:
		temp=i
		newpos=[i==0 for i in range(2**16)]
		for k in range(16):
			temp=(temp//2)+(2**15)*(temp%2)
			for j in range(2**16):
				if pos[j]:
					newpos[j|temp]=1
		pos=newpos
	for i in range(2**16-1,-1,-1):
		if pos[i]:
			print(i)
			break
0