結果

問題 No.2071 Shift and OR
ユーザー roarisroaris
提出日時 2022-09-16 22:11:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 106,144 KB
最終ジャッジ日時 2023-08-23 15:47:48
合計ジャッジ時間 9,195 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
78,812 KB
testcase_01 AC 126 ms
79,288 KB
testcase_02 AC 149 ms
80,216 KB
testcase_03 AC 193 ms
81,528 KB
testcase_04 AC 167 ms
80,824 KB
testcase_05 AC 242 ms
82,752 KB
testcase_06 AC 177 ms
80,944 KB
testcase_07 AC 156 ms
80,312 KB
testcase_08 AC 164 ms
80,828 KB
testcase_09 AC 173 ms
80,716 KB
testcase_10 AC 174 ms
80,896 KB
testcase_11 AC 251 ms
83,204 KB
testcase_12 AC 250 ms
83,428 KB
testcase_13 AC 239 ms
82,724 KB
testcase_14 AC 107 ms
77,908 KB
testcase_15 AC 204 ms
81,856 KB
testcase_16 AC 209 ms
81,852 KB
testcase_17 AC 260 ms
83,312 KB
testcase_18 AC 132 ms
79,280 KB
testcase_19 AC 279 ms
83,952 KB
testcase_20 AC 269 ms
84,056 KB
testcase_21 AC 325 ms
86,000 KB
testcase_22 AC 284 ms
84,488 KB
testcase_23 AC 129 ms
102,804 KB
testcase_24 AC 98 ms
77,468 KB
testcase_25 AC 110 ms
88,396 KB
testcase_26 AC 112 ms
90,148 KB
testcase_27 AC 96 ms
76,728 KB
testcase_28 AC 133 ms
106,108 KB
testcase_29 AC 131 ms
106,144 KB
testcase_30 AC 191 ms
81,452 KB
testcase_31 AC 181 ms
81,452 KB
testcase_32 AC 181 ms
81,444 KB
testcase_33 AC 184 ms
81,316 KB
testcase_34 AC 207 ms
81,264 KB
testcase_35 AC 182 ms
81,404 KB
testcase_36 AC 185 ms
81,148 KB
testcase_37 AC 177 ms
81,124 KB
testcase_38 AC 183 ms
81,408 KB
testcase_39 AC 184 ms
81,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

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

if N>=16:
    print((1<<16)-1)
    exit()

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

for Ai in A:
    ndp = [False]*(1<<16)
    now = Ai
    
    for _ in range(16):
        for S in range(1<<16):
            ndp[S|now] |= dp[S]
        
        now = (now%2)*(1<<15)+(now//2)
    
    dp = ndp

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