結果

問題 No.2071 Shift and OR
ユーザー rlangevinrlangevin
提出日時 2023-01-27 22:02:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 109,736 KB
最終ジャッジ日時 2023-09-10 15:58:51
合計ジャッジ時間 9,470 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
81,240 KB
testcase_01 AC 122 ms
77,592 KB
testcase_02 AC 134 ms
79,240 KB
testcase_03 AC 167 ms
86,608 KB
testcase_04 AC 151 ms
84,816 KB
testcase_05 WA -
testcase_06 AC 157 ms
86,204 KB
testcase_07 AC 142 ms
81,188 KB
testcase_08 AC 147 ms
81,432 KB
testcase_09 AC 160 ms
87,156 KB
testcase_10 AC 158 ms
87,012 KB
testcase_11 WA -
testcase_12 AC 193 ms
84,852 KB
testcase_13 WA -
testcase_14 AC 95 ms
76,724 KB
testcase_15 AC 171 ms
85,940 KB
testcase_16 AC 176 ms
88,692 KB
testcase_17 WA -
testcase_18 AC 119 ms
77,572 KB
testcase_19 WA -
testcase_20 AC 191 ms
85,488 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def shift(x):
    return ((x % 2) << 15) + x//2

N =int(input())
A = list(map(int, input().split()))
dp = [0] * (N + 1)
L = []
for i in range(N):
    p = A[i]
    for j in range(16):
        v = p
        for a in L:
            v |= a
        if v not in L:
            L.append(p)
            break            
        p = shift(p)
        
dp = [0] * (1 << 16)
dp[0] = 1 
M = len(L)
pre = set([0])
for i in range(M):
    S = set()
    v = A[i]
    for s in range(1 << 16):
        for j in range(16):
            if dp[s]:
                S.add(s|v)
            v = shift(v)
    for b in S:
        dp[b] = 1
    for c in pre:
        dp[c] = 0
    pre, S = S, pre

for i in range(2 ** 16 - 1, -1, -1):
    if dp[i]:
        print(i)
        break        
0