結果

問題 No.2071 Shift and OR
ユーザー ShirotsumeShirotsume
提出日時 2022-09-16 23:33:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 594 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 106,124 KB
最終ジャッジ日時 2023-08-23 16:50:27
合計ジャッジ時間 14,457 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
78,392 KB
testcase_01 AC 191 ms
79,300 KB
testcase_02 AC 245 ms
80,304 KB
testcase_03 AC 348 ms
81,404 KB
testcase_04 AC 289 ms
80,768 KB
testcase_05 AC 470 ms
82,924 KB
testcase_06 AC 304 ms
80,872 KB
testcase_07 AC 261 ms
80,404 KB
testcase_08 AC 283 ms
80,540 KB
testcase_09 AC 319 ms
81,064 KB
testcase_10 AC 305 ms
80,932 KB
testcase_11 AC 504 ms
83,388 KB
testcase_12 AC 487 ms
83,388 KB
testcase_13 AC 431 ms
82,692 KB
testcase_14 AC 117 ms
77,660 KB
testcase_15 AC 391 ms
81,716 KB
testcase_16 AC 406 ms
81,992 KB
testcase_17 AC 489 ms
83,488 KB
testcase_18 AC 190 ms
79,508 KB
testcase_19 AC 459 ms
84,036 KB
testcase_20 AC 557 ms
83,768 KB
testcase_21 AC 594 ms
85,588 KB
testcase_22 AC 559 ms
84,308 KB
testcase_23 AC 112 ms
102,824 KB
testcase_24 AC 79 ms
76,324 KB
testcase_25 AC 89 ms
87,764 KB
testcase_26 AC 93 ms
89,588 KB
testcase_27 AC 77 ms
75,852 KB
testcase_28 AC 114 ms
106,124 KB
testcase_29 AC 114 ms
106,120 KB
testcase_30 AC 339 ms
81,372 KB
testcase_31 AC 336 ms
81,280 KB
testcase_32 AC 313 ms
81,284 KB
testcase_33 AC 318 ms
81,380 KB
testcase_34 AC 337 ms
81,420 KB
testcase_35 AC 328 ms
81,236 KB
testcase_36 AC 340 ms
81,316 KB
testcase_37 AC 324 ms
81,300 KB
testcase_38 AC 337 ms
81,320 KB
testcase_39 AC 336 ms
81,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
INF = 2**63-1
mod = 998244353
n = ii()

a = li()

if n >= 16:
    print(2 ** 16 - 1)
else:
    dp = [[False] * (2 ** 16) for _ in range(n + 1)]
    dp[0][0] = True
    for i in range(n):
        for j in range(2 ** 16):
            for k in range(16):
                dp[i + 1][j] |= dp[i][j]
                dp[i + 1][j | a[i]] |= dp[i][j]
                a[i] = a[i] // 2 + 2 ** 15 * (a[i] % 2)
    ans = 0
    for i in range(2**16):
        if dp[n][i]:
            ans = max(ans, i)
    print(ans)
0