結果

問題 No.862 XORでX
ユーザー fine
提出日時 2019-08-24 00:09:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 1,567 ms
コンパイル使用メモリ 170,444 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 14:52:23
合計ジャッジ時間 7,562 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    
    int m = (n-1) / 4 * 4;
    vector<int> ans;
    for (int i = 0; i < m; i++) {
        ans.push_back(1000000 + i);
    }

    vector<int> hoge;
    if (n % 4 == 0) {
        if (x == 1) hoge = {1,2,4,6};
        else hoge = {1,2,3,x};
    } else if (n % 4 == 1) {
        hoge = {x};
    } else if (n % 4 == 2) {
        if (x == 1) hoge = {2, 3};
        else hoge = {1, (x^1)};
    } else {
        if (x == 1) hoge = {1, 4, 5};
        else hoge = {2, 3, (x^1)};
    }
    for (int x : hoge) ans.push_back(x);

    assert(ans.size() == n);
    for (int i = 0; i < n; i++) {
        cout << ans[i] << "\n";
    }
    return 0;
}
0