結果
問題 | No.2071 Shift and OR |
ユーザー |
![]() |
提出日時 | 2022-09-16 21:45:43 |
言語 | PyPy3 (7.3.8) |
結果 |
AC
|
実行時間 | 186 ms / 2,000 ms |
コード長 | 953 bytes |
コンパイル時間 | 379 ms |
使用メモリ | 98,400 KB |
最終ジャッジ日時 | 2023-01-11 06:26:33 |
合計ジャッジ時間 | 7,542 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 101 ms
82,792 KB |
testcase_01 | AC | 105 ms
83,288 KB |
testcase_02 | AC | 110 ms
84,300 KB |
testcase_03 | AC | 130 ms
85,344 KB |
testcase_04 | AC | 118 ms
84,832 KB |
testcase_05 | AC | 152 ms
87,056 KB |
testcase_06 | AC | 121 ms
84,876 KB |
testcase_07 | AC | 112 ms
84,588 KB |
testcase_08 | AC | 116 ms
84,844 KB |
testcase_09 | AC | 117 ms
84,808 KB |
testcase_10 | AC | 118 ms
84,880 KB |
testcase_11 | AC | 150 ms
87,544 KB |
testcase_12 | AC | 153 ms
87,328 KB |
testcase_13 | AC | 146 ms
86,940 KB |
testcase_14 | AC | 99 ms
82,100 KB |
testcase_15 | AC | 136 ms
85,968 KB |
testcase_16 | AC | 134 ms
85,664 KB |
testcase_17 | AC | 156 ms
87,628 KB |
testcase_18 | AC | 102 ms
83,244 KB |
testcase_19 | AC | 168 ms
87,900 KB |
testcase_20 | AC | 164 ms
88,108 KB |
testcase_21 | AC | 186 ms
89,584 KB |
testcase_22 | AC | 171 ms
88,632 KB |
testcase_23 | AC | 120 ms
96,484 KB |
testcase_24 | AC | 96 ms
81,772 KB |
testcase_25 | AC | 107 ms
87,564 KB |
testcase_26 | AC | 107 ms
89,068 KB |
testcase_27 | AC | 95 ms
81,272 KB |
testcase_28 | AC | 122 ms
98,392 KB |
testcase_29 | AC | 123 ms
98,400 KB |
testcase_30 | AC | 128 ms
85,284 KB |
testcase_31 | AC | 119 ms
85,464 KB |
testcase_32 | AC | 117 ms
85,456 KB |
testcase_33 | AC | 120 ms
85,608 KB |
testcase_34 | AC | 122 ms
85,524 KB |
testcase_35 | AC | 124 ms
85,112 KB |
testcase_36 | AC | 128 ms
85,580 KB |
testcase_37 | AC | 120 ms
85,324 KB |
testcase_38 | AC | 119 ms
85,340 KB |
testcase_39 | AC | 121 ms
85,180 KB |
ソースコード
from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def main(): def shift(x): return (x>>1)+((x&1)<<15) n = I() a = LI() m = 2**16 if n > 15: print(m-1) return f = [0]*m f[0] = 1 for i in a: nf = [0]*m for _ in range(16): for x in range(m): if not f[x]: continue nf[x|i] = 1 i = shift(i) f = nf for i in reversed(range(m)): if f[i]: print(i) return return if __name__ == "__main__": main()