結果

問題 No.2881 Mod 2^N
ユーザー とんぼとんぼ
提出日時 2024-09-08 14:06:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 171,424 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-08 14:06:48
合計ジャッジ時間 4,457 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(i=0;i<N;i++)
#define ll long long

int main(void){
    ll N,X,Y;
    ll x[64]={0},y[64]={0};

    ll i,j,k;

    cin>>N>>X>>Y;
    rep(i,N){
        if((X&(1LL<<i))!=0)x[i]=1;
        if((Y&(1LL<<i))!=0)y[i]=1;
    }
    reverse(x,x+N);
    reverse(y,y+N);

    rep(i,N)clog<<x[i];
    clog<<endl;
    rep(i,N)clog<<y[i];
    clog<<endl;

    ll shift=0;
    bool can=0;
    for(i=0;i<N;i++){
        bool same=1;
        for(j=0;i+j<N;j++){
            if(x[i+j]!=y[j])same=0;
        }
        if(same){
            shift=i;
            can=1;
            break;
        }
    }

    if(Y%2==0)can=0;

    ll A=1;
    vector<ll>ans;
    for(i=N-shift;i<N;i++){
        while(y[i]!=1&&A<N){A++;i++;}
        if(y[i]!=1)can=0;
        ans.push_back(A);
        A=1;
    }

    if(can){
        cout<<ans.size()<<endl;
        rep(i,ans.size())cout<<ans[i]<<' ';
        cout<<endl;
    }else cout<<-1<<endl;

    return 0;
}
0