結果

問題 No.2071 Shift and OR
ユーザー roarisroaris
提出日時 2022-09-16 22:11:43
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 264 ms
使用メモリ 110,348 KB
最終ジャッジ日時 2023-01-11 07:18:04
合計ジャッジ時間 9,666 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 125 ms
83,176 KB
testcase_01 AC 133 ms
83,976 KB
testcase_02 AC 151 ms
84,720 KB
testcase_03 AC 198 ms
85,476 KB
testcase_04 AC 169 ms
85,192 KB
testcase_05 AC 242 ms
87,488 KB
testcase_06 AC 182 ms
85,164 KB
testcase_07 AC 164 ms
84,844 KB
testcase_08 AC 168 ms
85,140 KB
testcase_09 AC 177 ms
85,192 KB
testcase_10 AC 180 ms
85,188 KB
testcase_11 AC 253 ms
87,944 KB
testcase_12 AC 257 ms
88,112 KB
testcase_13 AC 238 ms
87,320 KB
testcase_14 AC 115 ms
82,256 KB
testcase_15 AC 205 ms
86,264 KB
testcase_16 AC 210 ms
86,168 KB
testcase_17 AC 259 ms
87,816 KB
testcase_18 AC 138 ms
83,620 KB
testcase_19 AC 282 ms
88,696 KB
testcase_20 AC 264 ms
88,520 KB
testcase_21 AC 325 ms
90,012 KB
testcase_22 AC 285 ms
88,780 KB
testcase_23 AC 135 ms
107,016 KB
testcase_24 AC 104 ms
81,876 KB
testcase_25 AC 118 ms
92,620 KB
testcase_26 AC 120 ms
94,432 KB
testcase_27 AC 101 ms
81,268 KB
testcase_28 AC 140 ms
110,224 KB
testcase_29 AC 138 ms
110,348 KB
testcase_30 AC 196 ms
85,744 KB
testcase_31 AC 185 ms
85,936 KB
testcase_32 AC 188 ms
86,008 KB
testcase_33 AC 190 ms
85,672 KB
testcase_34 AC 212 ms
85,904 KB
testcase_35 AC 184 ms
85,512 KB
testcase_36 AC 186 ms
85,560 KB
testcase_37 AC 182 ms
85,488 KB
testcase_38 AC 189 ms
85,700 KB
testcase_39 AC 190 ms
85,784 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