結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-08-24 00:35:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| コード長 | 315 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 76,596 KB |
| 最終ジャッジ日時 | 2024-08-24 00:35:55 |
| 合計ジャッジ時間 | 1,605 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()))
for i in reversed(range(n)):
if (x>>c[i])&1==0:
r=((x>>c[i])+1)<<c[i]
if x<(1<<c[i]):
print((r-x)*2)
else:
print(min(r-x,x-(r-(1<<c[i])-1))*2)
break
else:
print(0)
sasa8uyauya