結果

問題 No.2881 Mod 2^N
ユーザー ooaiu
提出日時 2025-09-03 17:00:43
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 3,343 ms
コンパイル使用メモリ 278,904 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-03 17:00:49
合計ジャッジ時間 5,595 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N;
    ll X, Y;
    cin >> N >> X >> Y;
    if (Y % 2 == 0) {
        cout << -1 << "\n";
        return 0;
    }
    vector<int> ops;
    ops.push_back(N);
    int it = 0;
    for (int i = 0; i < N; i++)
        if (Y >> i & 1) it = i;
    for (int j = it - 1; j >= 0; j--) {
        if (Y >> j & 1) {
            int w = it - j;
            ops.push_back(w);
            it = j;
        }
    }
    cout << ops.size() << "\n";
    for (int i = 0; i < (int)ops.size(); i++) cout << ops[i] << " \n"[i == N - 1];

    return 0;
    const ll MOD = 1LL << N;
    for (int i = 0; i < (int)ops.size(); i++) {
        long long t = X;
        for (int j = 0; j < ops[i]; j++) {
            t *= 2;
            t %= MOD;
        }
        t += 1;
        X = t;
    }
    cout << X << " " << Y << endl;
}
0