結果

問題 No.2844 Birthday Party Decoration
ユーザー t98slider
提出日時 2024-08-23 21:58:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 191,928 KB
最終ジャッジ日時 2025-02-23 23:45:07
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--){
        ll n, x, S = 0;
        cin >> n >> x;
        ll ans = 0;
        for(int i = 0; i < n; i++){
            int v;
            cin >> v;
            S |= 1ll << v;
        }
        S &= ~x;
        if(S == 0){
            cout << 0 << '\n';
            continue;
        }
        ll T = 1ll << __lg(S);
        ans = T - (x & (T - 1));
        cout << 2 * ans << '\n';
    }
}
0