結果
問題 |
No.862 XORでX
|
ユーザー |
![]() |
提出日時 | 2019-08-09 22:57:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,494 bytes |
コンパイル時間 | 1,185 ms |
コンパイル使用メモリ | 110,800 KB |
最終ジャッジ日時 | 2025-01-07 11:30:33 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 16 |
ソースコード
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <deque> #include <queue> #include <array> #include <set> #include <map> #include <cmath> #include <algorithm> #include <numeric> #include <utility> #include <tuple> #include <functional> #include <bitset> #include <cstdint> #include <cassert> using namespace std; using i64 = int64_t; using i32 = int32_t; template<class T, class U> void init_n(vector<T>& v, size_t n, U x) { v = vector<T>(n, x); } template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); } template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) { v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; } template<class T> void read_n(T a[], size_t n, size_t o = 0) { for (size_t i=o; i<n+o; ++i) cin >> a[i]; } template<class T> T gabs(const T& x) { return max(x, -x); } #define abs gabs i64 n, x; int main() { cin >> n >> x; vector<i64> res; i64 cnt = 0; for (i64 i = 4; cnt < n - 4; i += 4, cnt += 4) { if (i <= x && x < i + 4) continue; for (i64 j = 0; j < 4; ++j) res.push_back(i + j); } i64 d = n - cnt; if (d == 1) { res.push_back(x); } else if (d == 2) { res.push_back(x ^ 1); res.push_back(1); } else if (d == 3) { res.push_back(x ^ 3); res.push_back(1); res.push_back(2); } else if (d == 4) { res.push_back(x); res.push_back(1); res.push_back(2); res.push_back(3); } for (i64 a : res) cout << a << '\n'; return 0; }