結果

問題 No.2071 Shift and OR
ユーザー shobonvipshobonvip
提出日時 2022-09-16 22:01:29
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 260 ms
使用メモリ 120,220 KB
最終ジャッジ日時 2023-01-11 06:56:50
合計ジャッジ時間 8,099 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 92 ms
82,116 KB
testcase_01 AC 94 ms
82,704 KB
testcase_02 AC 107 ms
83,624 KB
testcase_03 AC 138 ms
84,748 KB
testcase_04 AC 122 ms
84,164 KB
testcase_05 AC 179 ms
86,500 KB
testcase_06 AC 126 ms
84,252 KB
testcase_07 AC 111 ms
83,764 KB
testcase_08 AC 120 ms
84,140 KB
testcase_09 AC 121 ms
84,444 KB
testcase_10 AC 126 ms
84,192 KB
testcase_11 AC 180 ms
86,708 KB
testcase_12 AC 181 ms
87,200 KB
testcase_13 AC 170 ms
86,244 KB
testcase_14 AC 83 ms
81,820 KB
testcase_15 AC 150 ms
85,444 KB
testcase_16 AC 151 ms
85,656 KB
testcase_17 AC 188 ms
87,008 KB
testcase_18 AC 96 ms
82,848 KB
testcase_19 AC 210 ms
87,364 KB
testcase_20 AC 202 ms
87,604 KB
testcase_21 AC 243 ms
89,084 KB
testcase_22 AC 230 ms
87,900 KB
testcase_23 AC 199 ms
116,780 KB
testcase_24 AC 165 ms
90,268 KB
testcase_25 AC 177 ms
101,732 KB
testcase_26 AC 178 ms
103,704 KB
testcase_27 AC 162 ms
89,796 KB
testcase_28 AC 199 ms
120,220 KB
testcase_29 AC 202 ms
120,112 KB
testcase_30 AC 143 ms
84,964 KB
testcase_31 AC 127 ms
84,920 KB
testcase_32 AC 127 ms
84,964 KB
testcase_33 AC 131 ms
84,660 KB
testcase_34 AC 134 ms
84,740 KB
testcase_35 AC 134 ms
84,936 KB
testcase_36 AC 137 ms
84,776 KB
testcase_37 AC 131 ms
84,752 KB
testcase_38 AC 128 ms
84,932 KB
testcase_39 AC 130 ms
84,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# BIT DP を行う
# A[i] > 0 だから, 最大16個見ればok 
# dp[i][j] : i番目まで見てjが到達可能

n = int(input())
a = list(map(int,input().split()))
dp = [[0] * (1 << 16) for i in range(min(n, 16) + 1)]
dp[0][0] = 1

for i in range(min(n, 16)):
	for j in range(16):
		for k in range(1 << 16):
			if dp[i][k] == 1:
				dp[i+1][k|a[i]] = 1
		a[i] = (a[i] // 2) + (1 << 15) * (a[i] % 2)

r = 0
for i in range(1 << 16):
	if dp[min(n, 16)][i] == 1:
		r = i

print(r)
0