結果
問題 |
No.862 XORでX
|
ユーザー |
![]() |
提出日時 | 2019-08-09 22:42:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,287 bytes |
コンパイル時間 | 1,743 ms |
コンパイル使用メモリ | 169,236 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 14:46:39 |
合計ジャッジ時間 | 7,171 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 11 WA * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, x; cin >> n >> x; V<> res; auto add = [&](int l, int r) -> void { for (int i = l; i < r; ++i) { res.push_back(i); } }; if (n % 4 == 0) { add(1, 4); int m = n / 4 - 1; for (int i = 4; m; i += 4, --m) { if (i <= x and x < i + 4) continue; add(i, i + 4); } res.push_back(x); } else if (n % 4 == 1) { int m = n / 4; for (int i = 4; m; i += 4, --m) { if (i <= x and x < i + 4) continue; add(i, i + 4); } res.push_back(x); } else if (n % 4 == 2) { for (int i = x / 4 * 4; i < x / 4 * 4 + 4; ++i) if (i != x) { res.push_back(i); } add(1, 4); int m = n / 4; for (int i = 4; m; i += 4, --m) { if (i <= x and x < i + 4) continue; add(i, i + 4); } } else { for (int i = x / 4 * 4; i < x / 4 * 4 + 4; ++i) if (i != x) { res.push_back(i); } int m = n / 4; for (int i = 4; m; i += 4, --m) { if (i <= x and x < i + 4) continue; add(i, i + 4); } } for (int e : res) { cout << e << '\n'; } }