結果

問題 No.2071 Shift and OR
ユーザー 👑 timitimi
提出日時 2022-09-17 00:41:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 106,136 KB
最終ジャッジ日時 2023-08-23 17:16:54
合計ジャッジ時間 7,977 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
77,304 KB
testcase_01 AC 116 ms
78,236 KB
testcase_02 AC 112 ms
77,948 KB
testcase_03 AC 147 ms
78,096 KB
testcase_04 AC 122 ms
78,156 KB
testcase_05 AC 188 ms
80,060 KB
testcase_06 AC 130 ms
77,876 KB
testcase_07 AC 118 ms
78,276 KB
testcase_08 AC 123 ms
78,328 KB
testcase_09 AC 130 ms
77,960 KB
testcase_10 AC 135 ms
78,272 KB
testcase_11 AC 207 ms
79,876 KB
testcase_12 AC 195 ms
79,932 KB
testcase_13 AC 186 ms
80,112 KB
testcase_14 AC 100 ms
77,248 KB
testcase_15 AC 165 ms
79,944 KB
testcase_16 AC 167 ms
80,040 KB
testcase_17 AC 213 ms
80,008 KB
testcase_18 AC 106 ms
78,124 KB
testcase_19 AC 239 ms
81,912 KB
testcase_20 AC 233 ms
81,700 KB
testcase_21 AC 279 ms
81,208 KB
testcase_22 AC 246 ms
79,896 KB
testcase_23 AC 110 ms
102,584 KB
testcase_24 AC 79 ms
76,116 KB
testcase_25 AC 91 ms
87,652 KB
testcase_26 AC 92 ms
89,692 KB
testcase_27 AC 76 ms
75,696 KB
testcase_28 AC 121 ms
106,116 KB
testcase_29 AC 117 ms
106,136 KB
testcase_30 AC 151 ms
78,152 KB
testcase_31 AC 125 ms
78,076 KB
testcase_32 AC 125 ms
78,360 KB
testcase_33 AC 131 ms
78,148 KB
testcase_34 AC 135 ms
78,340 KB
testcase_35 AC 136 ms
78,248 KB
testcase_36 AC 143 ms
78,316 KB
testcase_37 AC 133 ms
78,264 KB
testcase_38 AC 135 ms
78,344 KB
testcase_39 AC 127 ms
78,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
if N>15:
  print(2**16-1)
  exit()
from collections import deque
D=[0]*(2**16)
D[0]=1
d=deque()
d.append(0)
def f(x):
  return x//2+(2**15)*(x%2)

for i in range(N):
  nd=deque()
  while d:
    now=d.popleft()
    a=A[i]
    nd.append(now)
    for j in range(16):
      dd=now|a
      if D[dd]==0:
        D[dd]=1
        nd.append(dd)
      a=f(a)
  d=nd

ans=0
for i in range(2**16):
  if D[i]==1:
    ans=max(ans,i)
print(ans)
        
  
0