結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2024-08-23 21:18:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 113 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 77,020 KB |
| 最終ジャッジ日時 | 2024-08-23 21:18:20 |
| 合計ジャッジ時間 | 1,101 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
for _ in range(int(input())):
n, x = map(int, input().split())
c = map(int, input().split())
mx = -1
for ci in c:
if x >> ci & 1 == 0:
mx = max(mx, ci)
if mx == -1:
print(0)
continue
tgt = ((x & ((1 << mx) - 1)) ^ x) | (1 << mx)
ans = tgt - x
tgt -= (1 << mx) + 1
if tgt >= 0:
ans = min(ans, x - tgt)
print(2 * ans)
Kude