結果
| 問題 |
No.2844 Birthday Party Decoration
|
| コンテスト | |
| ユーザー |
tama04
|
| 提出日時 | 2024-08-23 22:43:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 820 bytes |
| コンパイル時間 | 3,368 ms |
| コンパイル使用メモリ | 277,596 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-08-23 22:43:52 |
| 合計ジャッジ時間 | 3,834 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for(int i = (s); i < n; i++)
int main(void) {
int t;
cin >> t;
int n;
ll x;
vector<ll> ans;
rep(i, 0, t) {
cin >> n >> x;
vector<ll> c(n);
rep(j, 0, n) {
cin >> c[j];
c[j] = (1LL << c[j]);
}
ll res = 0;
//cout << "t = " << i << endl;
rep(k, 0, n) {
//cout << " k = " << k << " c = " << c[k] << endl;
if ((x & c[k]) == 0) {
ll temp = 0;
for (int bit = 0; bit < 60; bit++) {
temp |= (x & (1LL << bit));
if (c[k] & (1LL << bit)) {
res += ((1LL << bit) - temp);
x += ((1LL << bit) - temp);
}
}
//cout << " temp = " << temp << " res = " << res << endl;
}
}
ans.push_back(res * 2);
}
rep(i, 0, ans.size()) {
cout << ans[i] << endl;
}
return 0;
}
tama04