結果

問題 No.1228 I hate XOR Matching
ユーザー auauaauaua
提出日時 2020-09-11 23:21:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,945 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 170,232 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 16:57:14
合計ジャッジ時間 7,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll INF=1e9+7;
const ll MOD=998244353;
const int MAX=200010;


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k,x;cin>>k>>x;
    vector<ll>beki(41);
    beki[0]=1;
    REP(i,1,41){
        beki[i]=beki[i-1]*2LL;
    }
    if(x==0){
        cout<<"Yes"<<endl;
        cout<<1<<endl;
        cout<<(k+1)%beki[20]<<endl;
        return 0;
    }
    if(k==0){
        ll ans=-1;
        rep(i,22){
            if(beki[i]-1==x)ans=i;
        }
        if(ans<0){
            cout<<"No"<<endl;
        }else{
            cout<<"Yes"<<endl;
            vector<ll>res(0);
            if(ans==1){
                cout<<1<<endl;
                cout<<0<<endl;
            }
            else if(ans==2){
                cout<<2<<endl;
                cout<<0<<' '<<0<<endl;
            }else{
                ans-=2;
                res.pb(0);
                res.pb(0);
                ll now=0;
                rep(i,ans){
                    res.pb(1LL<<now);
                    res.pb(1LL<<now);
                    now++;
                }
                cout<<res.size()<<endl;
                rep(i,res.size()){
                    cout<<res[i]<<' ';
                }
                cout<<endl;
            }
        }
    }else{
        ll ans=-1;
        rep(i,22){
            if(beki[i]==x){
                ans=i;
                break;
            }
        }
        if(ans<0){
            cout<<"No"<<endl;
        }else{
            cout<<"Yes"<<endl;
            if(ans==0){
                cout<<1<<endl;
                cout<<k<<endl;
            }if(ans==1){
                cout<<1<<endl;
                cout<<k<<' '<<0<<endl;
            }else{
                vector<ll>res(0);
                res.pb(k);
                res.pb(0);
                res.pb(0);
                if(ans==21){
                    res.pb(k);
                    ans--;
                }
                ans-=2;
                ll mi=0;
                while(((1LL<<mi)&k)==0){
                    mi++;
                }
                ll now=0;
                rep(i,ans){
                    if(mi==now)now++;
                    res.pb(1LL<<now);
                    res.pb(1LL<<now);
                    now++;
                }
                cout<<res.size()<<endl;
                rep(i,res.size()){
                    cout<<res[i]<<' ';
                }
                cout<<endl;
            }
        }
    }
}
0