結果
問題 |
No.2844 Birthday Party Decoration
|
ユーザー |
|
提出日時 | 2024-08-23 21:27:18 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 5,095 ms |
コンパイル使用メモリ | 315,812 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-23 21:27:24 |
合計ジャッジ時間 | 5,417 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 4 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; int main() { int t; cin>>t; while(t--){ int n; ll x; cin>>n>>x; vector<int> c(n); for(int i=0;i<n;i++)cin>>c[i]; sort(c.rbegin(),c.rend()); ll ans=0; for(int i=0;i<n;i++){ if(x>>c[i]&1)continue; else{ ll t=1LL<<62; t=min(t,((x>>(c[i]+1))<<(c[i]+1))+(1<<c[i])-x); if(x>=(1LL<<c[i])) t=min(t,x-((x>>(c[i]+1))<<(c[i]+1))+1); ans=t*2; break; } } cout<<ans<<endl; } }