結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2024-08-23 21:45:18 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 561 ms / 2,000 ms |
| コード長 | 404 bytes |
| コンパイル時間 | 218 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-08-23 21:45:22 |
| 合計ジャッジ時間 | 3,000 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
for _ in range(int(input())):
n,x = map(int,input().split())
l = [x]; r = [x]; z = 1<<61
for v in map(int,input().split()):
if x>>v&1: l.append(v); r.append(v)
else: y = (1<<v)-1&x^x; l.append(y-1); r.append(y|1<<v)
for p in l:
if p<0: continue
q = x
for li,ri in zip(l,r):
if li<p: q = max(q,ri)
z = min(z,2*(q-p))
print(z)
ニックネーム