結果

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

ソースコード

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 == 0) {
        cout << "No\n";
        return 0;
    }
    if (k == 1) {
        if (y - x < n - 1) {
            cout << "No\n";
            return 0;
        }
        cout << "Yes\n";
        vector<ll> res(n);
        res[0] = x;
        ll tot = y - 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 + 1, 0);
    res[1] = x;
    if (n >= 2) res[2] = 0;
    for (int i = 3; i <= n - k - 1; i++) res[i] = (i & 1) ? (1 << 19) : ((1 << 19) + 1);
    for (int i = max(3, (int)(n - k)); i <= n - 1; i++) res[i] = 0;
    res[n - k] = y - 1;
    res[n] = y;
    for (int i = 1; i <= n; i++) cout << res[i] << " ";
    cout << "\n";
    return 0;
}
0