結果

問題 No.2071 Shift and OR
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-09-16 21:56:09
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 245 ms
使用メモリ 110,616 KB
最終ジャッジ日時 2023-01-11 06:43:59
合計ジャッジ時間 5,953 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 79 ms
81,200 KB
testcase_01 AC 84 ms
81,188 KB
testcase_02 AC 85 ms
81,356 KB
testcase_03 AC 95 ms
81,496 KB
testcase_04 AC 88 ms
81,404 KB
testcase_05 AC 108 ms
81,812 KB
testcase_06 AC 89 ms
81,628 KB
testcase_07 AC 86 ms
81,228 KB
testcase_08 AC 86 ms
81,476 KB
testcase_09 AC 90 ms
81,544 KB
testcase_10 AC 90 ms
81,484 KB
testcase_11 AC 111 ms
81,872 KB
testcase_12 AC 106 ms
81,828 KB
testcase_13 AC 108 ms
81,616 KB
testcase_14 AC 78 ms
81,256 KB
testcase_15 AC 99 ms
81,276 KB
testcase_16 AC 99 ms
81,396 KB
testcase_17 AC 113 ms
81,884 KB
testcase_18 AC 85 ms
81,388 KB
testcase_19 AC 118 ms
81,444 KB
testcase_20 AC 118 ms
81,944 KB
testcase_21 AC 132 ms
81,800 KB
testcase_22 AC 123 ms
81,728 KB
testcase_23 AC 109 ms
107,180 KB
testcase_24 AC 79 ms
80,888 KB
testcase_25 AC 93 ms
92,232 KB
testcase_26 AC 96 ms
94,104 KB
testcase_27 AC 78 ms
80,416 KB
testcase_28 AC 113 ms
110,616 KB
testcase_29 AC 116 ms
110,396 KB
testcase_30 AC 93 ms
81,356 KB
testcase_31 AC 88 ms
81,208 KB
testcase_32 AC 88 ms
81,488 KB
testcase_33 AC 90 ms
81,444 KB
testcase_34 AC 91 ms
81,504 KB
testcase_35 AC 93 ms
81,420 KB
testcase_36 AC 93 ms
81,640 KB
testcase_37 AC 90 ms
81,388 KB
testcase_38 AC 89 ms
81,276 KB
testcase_39 AC 91 ms
81,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))

if n > 16:
    print(2**16-1)
    exit()


dp = [0]*(1<<16)

dp[0] = 1

for a in A:
    for i in range(1<<16)[::-1]:
        if dp[i] == 0:
            continue
        base = a
        # print("base",base)
        for j in range(16):
            dp[i|base] = 1
            base =  (1<<15)*(base%2) + base//2 
            # print(base)
for i in range(1<<16)[::-1]:
    if dp[i]:
        print(i)
        exit()
0