結果
| 問題 |
No.1228 I hate XOR Matching
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-11 21:43:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,252 bytes |
| コンパイル時間 | 1,197 ms |
| コンパイル使用メモリ | 93,968 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 10:16:51 |
| 合計ジャッジ時間 | 4,518 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;
Int k, x;
Int calc(int x){
return (1 << x) * 2 - x;
}
void output(vector<int> vec){
cout << "Yes" << endl;
cout << vec.size() << endl;
for(auto elem:vec)cout << elem << " ";cout << endl;
exit(0);
}
void no(){
puts("No");
exit(0);
}
int main(){
cin >> k >> x;
if(x == 0)output({!k});
if(k == 0)x++;
if((x & -x) != x)no();
vector<int> ans;
for(int i = 0;i < 5;i++){
ans.push_back(1 << i);
}
int back = 4;
while(ans[back] > k)back--;
ans[back] = k;
for(int cnt = 1, i = 0;cnt < x;cnt *= 2,i++){
int num = 0;
for(int j = 0;j < 5;j++){
if((i >> j) % 2)num ^= ans[j];
}
ans.push_back(num);
}
output(ans);
return 0;
}