結果

問題 No.1228 I hate XOR Matching
ユーザー leaf_1415leaf_1415
提出日時 2020-09-11 22:24:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,584 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 74,388 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 15:10:54
合計ジャッジ時間 11,297 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define PI 3.1415926535897932384626433832795028841971
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint k, x;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> k >> x;
	
	if(k == 0){
		if(x == 0){
			cout << "Yes" << endl;
			cout << 1 << endl;
			cout << 1 << endl;
			return 0;
		}
		if((x+1)&x){
			cout << "No" << endl;
			return 0;
		}
		llint r = 0;
		x++;
		for(;x;x/=2) r++;
		r--;
		
		cout << "Yes" << endl;
		cout << 2*r << endl;
		for(int i = 0; i < r; i++){
			cout << (1<<i) << " " << (1<<i) << " ";
		}
		cout << endl;
		return 0;
	}
	
	if(x == 0){
		cout << "Yes" << endl;
		cout << 1 << endl;
		cout << 0 << endl;
		return 0;
	}
	if((x-1)&x){
		cout << "No" << endl;
		return 0;
	}
	
	llint r = 0;
	for(;x;x/=2) r++;
	r--;
	
	cout << "Yes" << endl;
	cout << 2*r+1 << endl;
	for(int i = 0; i < r; i++){
		if(k&(k-1)) cout << (1<<i) << " " << (1<<i) << " ";
		else cout << (1<<20)-1-(1<<i) << " " << (1<<20)-1-(1<<i) << " ";
	}
	cout << k << endl;
	cout << endl;
	
	return 0;
}
0