結果

問題 No.2071 Shift and OR
ユーザー 👑 timitimi
提出日時 2022-09-17 00:41:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 82,604 KB
実行使用メモリ 100,736 KB
最終ジャッジ日時 2024-06-01 14:42:07
合計ジャッジ時間 6,072 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
60,288 KB
testcase_01 AC 57 ms
63,616 KB
testcase_02 AC 63 ms
66,796 KB
testcase_03 AC 113 ms
78,592 KB
testcase_04 AC 76 ms
71,424 KB
testcase_05 AC 150 ms
78,464 KB
testcase_06 AC 86 ms
73,600 KB
testcase_07 AC 67 ms
68,480 KB
testcase_08 AC 71 ms
69,504 KB
testcase_09 AC 79 ms
72,824 KB
testcase_10 AC 84 ms
74,548 KB
testcase_11 AC 165 ms
80,128 KB
testcase_12 AC 149 ms
78,532 KB
testcase_13 AC 140 ms
78,464 KB
testcase_14 AC 50 ms
59,776 KB
testcase_15 AC 121 ms
78,336 KB
testcase_16 AC 123 ms
78,592 KB
testcase_17 AC 165 ms
78,336 KB
testcase_18 AC 56 ms
63,488 KB
testcase_19 AC 196 ms
80,480 KB
testcase_20 AC 190 ms
80,096 KB
testcase_21 AC 239 ms
81,876 KB
testcase_22 AC 210 ms
80,256 KB
testcase_23 AC 82 ms
96,512 KB
testcase_24 AC 47 ms
61,952 KB
testcase_25 AC 61 ms
76,288 KB
testcase_26 AC 62 ms
79,096 KB
testcase_27 AC 43 ms
57,984 KB
testcase_28 AC 85 ms
100,352 KB
testcase_29 AC 88 ms
100,736 KB
testcase_30 AC 112 ms
78,592 KB
testcase_31 AC 76 ms
70,912 KB
testcase_32 AC 84 ms
71,168 KB
testcase_33 AC 82 ms
72,960 KB
testcase_34 AC 88 ms
73,984 KB
testcase_35 AC 90 ms
73,984 KB
testcase_36 AC 102 ms
78,556 KB
testcase_37 AC 82 ms
72,704 KB
testcase_38 AC 81 ms
72,448 KB
testcase_39 AC 76 ms
72,448 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