結果
問題 | No.2844 Birthday Party Decoration |
ユーザー |
![]() |
提出日時 | 2024-07-14 16:32:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 82,092 KB |
実行使用メモリ | 77,444 KB |
最終ジャッジ日時 | 2024-07-14 16:32:43 |
合計ジャッジ時間 | 2,141 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
t = int(input())for _ in range(t):n, x = map(int, input().split())c = list(map(int, input().split()))ans = 0for i in c:if x & (1 << i):continueplus = ((x >> i) + 1) << iminus = ((x >> i) << i) - 1if (minus < 0 and ans < (plus - x) * 2):ans = (plus - x) * 2elif (minus >= 0 and ans < min(plus - x, x - minus) * 2):ans = min(plus - x, x - minus) * 2print(ans)