結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-24 19:15:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| コード長 | 434 bytes |
| コンパイル時間 | 403 ms |
| コンパイル使用メモリ | 82,152 KB |
| 実行使用メモリ | 76,348 KB |
| 最終ジャッジ日時 | 2024-08-24 19:15:22 |
| 合計ジャッジ時間 | 1,615 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
def solve():
n,x=map(int,input().split())
c=list(map(int,input().split()))
for I in range(n):
i=n-I-1
if (x>>c[i]&1)==False:
bc=1<<c[i]
floor=(x//bc)*bc
ceil=(x//bc+1)*bc
if(floor==0):
return (ceil-x)*2
else:
return min((ceil-x)*2,(x-(floor-1))*2)
return 0
t=int(input())
for _ in range(t):
print(solve())