結果

問題 No.3223 K-XOR Increasing Sequence
ユーザー jiangxinyang
提出日時 2025-08-01 21:39:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 984 bytes
コンパイル時間 1,802 ms
コンパイル使用メモリ 197,580 KB
実行使用メモリ 11,180 KB
最終ジャッジ日時 2025-08-01 21:39:44
合計ジャッジ時間 26,011 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 21 WA * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const int N = 200005;
const int INF = 0x3f3f3f3f;

int main() {
    ll n, k, x, y;
    cin >> n >> k >> x >> y;
    if (!y) {
        cout << "No\n";
        return 0;
    }
    if (k == 1) {
        if (y - x < n - 1) {
            cout << "No\n";
            return 0;
        }
        cout << "Yes\n";
        ll tot = y - x;
        vector<ll> res(n);
        res[0] = x;
        for (int i = 1; i < n - 1; i++) {
            res[i] = res[i - 1] + 1;
            tot--;
        }
        res[n - 1] = res[n - 2] + tot;
        for (auto x : res) cout << x << " ";
        cout << "\n";
        return 0;
    }
    cout << "Yes\n";
    vector<ll> res(n);
    res[0] = x;
    if (n >= 2) res[1] = 0;
    for (int i = 2; i < n - 1; i++) res[i] = ((i + 1) & 1) ? (1ll << 19) : ((1ll << 19) + 1);
    res[n - 1] = y;
    for (auto x : res) cout << x << " ";
    cout << "\n";
    return 0;
}
0