結果
問題 |
No.3223 K-XOR Increasing Sequence
|
ユーザー |
|
提出日時 | 2025-08-01 23:19:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,541 bytes |
コンパイル時間 | 1,850 ms |
コンパイル使用メモリ | 198,140 KB |
実行使用メモリ | 10,988 KB |
最終ジャッジ日時 | 2025-08-01 23:20:14 |
合計ジャッジ時間 | 17,949 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 14 WA * 56 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> istream& operator >> (istream& is, vector<T>& vec) { for(T& x : vec) is >> x; return is; } template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, k, x, y; cin >> n >> k >> x >> y; if(y == 0){ cout << "No\n"; return 0; } vector<int> ans(n); ans[0] = x; ans[n - 1] = y; if(k == 1){ for(int i = 1; i + 1 < n; i++){ ans[i] = ans[i - 1] + 1; } if(ans[n - 2] < ans[n - 1]){ cout << "Yes\n" << ans << '\n'; }else{ cout << "No\n"; } return 0; }else if(k == 2){ if(x != 0){ for(int i = 1; i + 1 < n; i++){ ans[i] = x; } cout << "Yes\n" << ans << '\n'; }else{ cout << "No\n"; } }else{ if(x != 0){ vector<int> S(k); int tot = x; S[0] = x; for(int i = 1; i + 1 < k; i++){ S[i] = 0b1010101; tot ^= 0b1010101; } S.back() = tot; for(int i = 0; i < n; i++) ans[i] = S[i % k]; cout << "Yes\n" << ans << '\n'; }else{ cout << "No\n"; } } }