結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-08-23 21:40:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 596 bytes |
| コンパイル時間 | 1,807 ms |
| コンパイル使用メモリ | 195,940 KB |
| 最終ジャッジ日時 | 2025-02-23 23:36:09 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
void solve() {
int n;
long long x;
cin >> n >> x;
vector<int> c;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
if (x & (1LL << a)) {
continue;
}
c.push_back(a);
}
if (c.empty()) {
cout << 0 << endl;
return;
}
for (int i = c.back() + 1; i <= 60; i++) {
if (x & (1LL << i)) {
x ^= (1LL << i);
}
}
long long ans = (1LL << c.back());
cout << 2 * (ans - x) << endl;
}
int main() {
fast_io();
int t;
cin >> t;
for (; t--;) {
solve();
}
}
eve__fuyuki