結果

問題 No.2071 Shift and OR
ユーザー ntudantuda
提出日時 2022-09-18 21:42:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 86,480 KB
実行使用メモリ 106,040 KB
最終ジャッジ日時 2023-08-23 18:20:18
合計ジャッジ時間 7,269 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
77,292 KB
testcase_01 AC 88 ms
77,804 KB
testcase_02 AC 93 ms
78,696 KB
testcase_03 AC 99 ms
79,684 KB
testcase_04 AC 94 ms
79,300 KB
testcase_05 AC 110 ms
81,288 KB
testcase_06 AC 145 ms
79,428 KB
testcase_07 AC 97 ms
78,748 KB
testcase_08 AC 95 ms
79,316 KB
testcase_09 AC 95 ms
79,536 KB
testcase_10 AC 97 ms
79,656 KB
testcase_11 AC 113 ms
82,112 KB
testcase_12 AC 113 ms
82,040 KB
testcase_13 AC 108 ms
81,676 KB
testcase_14 AC 81 ms
76,872 KB
testcase_15 AC 102 ms
80,564 KB
testcase_16 AC 103 ms
80,260 KB
testcase_17 AC 112 ms
82,108 KB
testcase_18 AC 86 ms
77,684 KB
testcase_19 AC 115 ms
82,624 KB
testcase_20 AC 117 ms
82,516 KB
testcase_21 AC 126 ms
84,276 KB
testcase_22 AC 121 ms
83,008 KB
testcase_23 AC 106 ms
102,588 KB
testcase_24 AC 76 ms
75,960 KB
testcase_25 AC 87 ms
87,208 KB
testcase_26 AC 90 ms
89,620 KB
testcase_27 AC 74 ms
75,700 KB
testcase_28 AC 108 ms
106,040 KB
testcase_29 AC 108 ms
105,740 KB
testcase_30 AC 103 ms
80,248 KB
testcase_31 AC 100 ms
79,988 KB
testcase_32 AC 99 ms
79,896 KB
testcase_33 AC 99 ms
79,980 KB
testcase_34 AC 99 ms
79,872 KB
testcase_35 AC 100 ms
79,824 KB
testcase_36 AC 100 ms
79,748 KB
testcase_37 AC 100 ms
79,876 KB
testcase_38 AC 101 ms
79,824 KB
testcase_39 AC 101 ms
80,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
NM = 1 << 16
if N >= 16:
    print(NM - 1)
    exit()

dp = [0] * NM
dp[0] = 1
for a in A:
    dp2 = [0] * NM
    for i in range(16):
        for j in range(NM):
            dp2[j|a] |= dp[j]
        a = (a >> 1) | ((a & 1) << 15)
    dp = dp2
for i in reversed(range(NM)):
    if dp[i] == 1:
        break
print(i)
0