結果

問題 No.1871 divisXor
ユーザー ruthen71
提出日時 2022-03-11 22:28:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 804 bytes
コンパイル時間 1,640 ms
コンパイル使用メモリ 171,940 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 12:59:09
合計ジャッジ時間 4,131 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

#include <atcoder/modint>
using namespace atcoder;
using mint = modint998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    if (N == 0) {
        cout << -1 << '\n';
        return 0;
    }
    V<ll> A;
    for (int i = 60; i >= 0; i--) {
        if (N >> i & 1) {
            show(i);
            A.push_back(1LL << i);
            N ^= ((1LL << (i + 1)) - 1);
        }
        show(N);
    }
    cout << A.size() << '\n';
    rep(i, A.size()) cout << A[i] << (i == A.size() - 1 ? '\n' : ' ');
    show(A);
    return 0;
}
0