結果

問題 No.2071 Shift and OR
ユーザー lilictakalilictaka
提出日時 2022-09-19 00:16:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 101,344 KB
最終ジャッジ日時 2024-06-01 15:52:33
合計ジャッジ時間 4,227 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
60,796 KB
testcase_01 AC 49 ms
63,548 KB
testcase_02 AC 52 ms
63,012 KB
testcase_03 AC 69 ms
65,804 KB
testcase_04 AC 57 ms
64,260 KB
testcase_05 AC 88 ms
70,572 KB
testcase_06 AC 60 ms
64,720 KB
testcase_07 AC 53 ms
63,364 KB
testcase_08 AC 57 ms
63,792 KB
testcase_09 AC 59 ms
63,592 KB
testcase_10 AC 63 ms
64,724 KB
testcase_11 AC 93 ms
71,320 KB
testcase_12 AC 94 ms
71,456 KB
testcase_13 AC 86 ms
69,408 KB
testcase_14 AC 43 ms
58,696 KB
testcase_15 AC 74 ms
67,180 KB
testcase_16 AC 74 ms
68,424 KB
testcase_17 AC 93 ms
70,968 KB
testcase_18 AC 48 ms
61,576 KB
testcase_19 AC 114 ms
75,040 KB
testcase_20 AC 97 ms
72,104 KB
testcase_21 AC 118 ms
76,504 KB
testcase_22 AC 117 ms
75,916 KB
testcase_23 AC 76 ms
97,336 KB
testcase_24 AC 44 ms
61,748 KB
testcase_25 AC 58 ms
76,924 KB
testcase_26 AC 58 ms
79,680 KB
testcase_27 AC 41 ms
59,060 KB
testcase_28 AC 81 ms
100,712 KB
testcase_29 AC 80 ms
101,344 KB
testcase_30 AC 69 ms
65,836 KB
testcase_31 AC 58 ms
65,476 KB
testcase_32 AC 59 ms
64,296 KB
testcase_33 AC 60 ms
65,648 KB
testcase_34 AC 64 ms
64,932 KB
testcase_35 AC 63 ms
65,124 KB
testcase_36 AC 68 ms
65,604 KB
testcase_37 AC 63 ms
64,668 KB
testcase_38 AC 61 ms
64,064 KB
testcase_39 AC 59 ms
64,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
if N >= 16:
    print((1<<16)-1)
    exit()
dp = [[False] *(1<<16) for _ in range(N)]
def shift(x):
    return x//2 + (1<<15) *(x%2)
B = [[] for _ in range(N)]
for i in range(N):
    x = A[i]
    for _ in range(16):
        x = shift(x)
        B[i].append(x)
for x in B[0]:
    dp[0][x] = True
for i in range(N-1):
    for s in range(1<<16):
        if dp[i][s]:
            for x in B[i+1]:
                dp[i+1][s|x] = True
for s in reversed(range(1<<16)):
    if dp[N-1][s]:
        print(s)
        exit()
0