結果
| 問題 | No.2844 Birthday Party Decoration |
| ユーザー |
👑 |
| 提出日時 | 2024-08-23 21:28:12 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 65 ms / 2,000 ms |
| + 268µs | |
| コード長 | 414 bytes |
| 記録 | |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 64,572 KB |
| 実行使用メモリ | 59,168 KB |
| 最終ジャッジ日時 | 2026-11-01 19:46:47 |
| 合計ジャッジ時間 | 1,736 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
def solve():
n, x = map(int, input().split())
C = list(map(int, input().split()))
while C and (x >> C[-1]) & 1:
C.pop()
if not C:
print(0)
return
c = C[-1]
if x < (1 << c):
ans = (1 << c) - x
print(2 * ans)
return
t = x & ((1 << c) - 1)
ans = min(t + 1, (1 << c) - t)
print(2 * ans)
for _ in range(int(input())):
solve()