結果
問題 | No.2071 Shift and OR |
ユーザー | yosaka |
提出日時 | 2022-09-16 23:45:02 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 96 ms |
コンパイル使用メモリ | 10,880 KB |
実行使用メモリ | 19,272 KB |
最終ジャッジ日時 | 2023-08-23 17:00:33 |
合計ジャッジ時間 | 39,048 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 491 ms
19,272 KB |
testcase_01 | AC | 702 ms
9,640 KB |
testcase_02 | AC | 1,057 ms
9,540 KB |
testcase_03 | AC | 1,506 ms
9,556 KB |
testcase_04 | AC | 1,282 ms
9,504 KB |
testcase_05 | TLE | - |
testcase_06 | AC | 1,311 ms
9,520 KB |
testcase_07 | AC | 1,070 ms
9,496 KB |
testcase_08 | AC | 1,439 ms
9,692 KB |
testcase_09 | AC | 1,265 ms
9,496 KB |
testcase_10 | AC | 1,400 ms
9,692 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | AC | 251 ms
9,556 KB |
testcase_15 | AC | 1,677 ms
9,664 KB |
testcase_16 | AC | 1,955 ms
9,528 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 722 ms
9,696 KB |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
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 | -- | - |
ソースコード
N = int(input()) A = list(map(int, input().split())) ans = 0 if N >= 16: print(2**16 - 1) exit() def shift(x): return x // 2 + pow(2, 15) * (x % 2) M = 1 << 16 dp = [False] * M dp[0] = True for a in A: ndp = [False] * M now = a for _ in range(16): for s in range(M): ndp[s | now] |= dp[s] now = shift(now) dp = ndp[:] ans = 0 for i in range(M): if dp[i]: ans = max(ans, i) print(ans)