結果
| 問題 | No.2844 Birthday Party Decoration |
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2024-08-23 21:45:18 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 648 ms / 2,000 ms |
| コード長 | 404 bytes |
| 記録 | |
| コンパイル時間 | 935 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 15,392 KB |
| 最終ジャッジ日時 | 2026-04-03 21:56:46 |
| 合計ジャッジ時間 | 4,479 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
ニックネーム