結果

問題 No.3223 K-XOR Increasing Sequence
ユーザー Carpenters-Cat
提出日時 2025-08-01 22:52:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 1,972 ms
コンパイル使用メモリ 195,892 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-01 22:53:15
合計ジャッジ時間 21,194 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 16 WA * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	if (Y == 0) {
		puts("No");
		return 0;
	}
	if (K == 1) {
		int lst = X + (N - 1);
		if (Y < lst) {
			puts("No");
		} else {
			puts("Yes");
			for (int i = 0; i < N-1; i ++) {
				cout << X + i << " ";
			}
			cout << Y << endl;
		}
		return 0;
	}
	puts("Yes");
	std::vector<int> ans(N, 0);
	ans[0] = ans[1] = X;
	ans.back() = Y;
	for (int i = K; i < N-1; i ++) {
		ans[i] = ans[i-K];
	}
	for (int& a : ans) cout << a << " ";
	cout << endl;
}
0