結果
| 問題 |
No.1228 I hate XOR Matching
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-09-28 13:14:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 834 bytes |
| コンパイル時間 | 1,676 ms |
| コンパイル使用メモリ | 172,128 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 23:06:05 |
| 合計ジャッジ時間 | 10,446 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
vector<ULL> f(ULL X){
X+=1;
if(X&(X-1)) return {};
ULL D = 1;
vector<ULL> ans;
rep(t,2) if(X>=(1ull<<1)){ ans.push_back(0); X>>=1; }
while(X>=(1ull<<4)){ rep(t,2)rep(k,3) ans.push_back((k+1)<<D); D<<=2; X>>=4; }
while(X>=(1ull<<1)){ rep(t,2) ans.push_back(1<<D); D<<=1; X>>=1; }
return ans;
}
int main() {
ULL K,X; cin>>K>>X;
vector<ULL> ans;
if(K==0) ans=f(X);
else{
ans=f(X-1);
if(!ans.empty()){
ULL d = X&~(X-1);
for(ULL& a : ans){ a = (a&(d-1)) | ((a&~(d-1))<<1); }
ans.push_back(K);
}
}
if(ans.empty()) cout<<"No"<<endl;
else{
cout<<"Yes"<<endl;
cout<<ans.size()<<endl;
rep(i,ans.size()){ if(i) cout<<" "; cout<<ans[i]; } cout<<endl;
}
return 0;
}
Nachia