結果

問題 No.1228 I hate XOR Matching
ユーザー catuppercatupper
提出日時 2020-09-11 21:43:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,252 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 88,084 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 13:32:22
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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;
}
0