結果

問題 No.862 XORでX
ユーザー gratan_mogmoggratan_mogmog
提出日時 2019-08-09 22:50:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,406 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 172,596 KB
実行使用メモリ 5,148 KB
最終ジャッジ日時 2023-09-26 21:10:45
合計ジャッジ時間 6,700 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 1e17;
const char ENDL = '\n';

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,x;
    cin >> n >> x;
    if (x==1){
        vll ans;
        int k = 1;
        rep(i, (n - 1) / 4)
        {
            if (4 * k <= x && x < 4 * (k + 1))
            {
                k++;
                continue;
            }
            ans.eb(4 * k);
            ans.eb(4 * k + 1);
            ans.eb(4 * k + 2);
            ans.eb(4 * k + 3);
        }
        if (n % 4 == 0)
        {
            ans.eb(1e5);
            ans.eb(1e5 + 2);
            ans.eb(2);
            ans.eb(x);
        }
        if (n % 4 == 1)
        {
            ans.eb(x);
        }
        if (n % 4 == 2)
        {
            ans.eb(1e5 + 4);
            ans.eb(1e5 + 5);
        }
        if (n % 4 == 3)
        {
            ans.eb(3);
            ans.eb(1e5);
            ans.eb(1e5 + 2);
        }
    }
    vll ans;
    int k = 1;
    rep(i,(n-1)/4){
        if (4*k<=x && x<4*(k+1)){
            k++;
            continue;
        }
        ans.eb(4 * k);
        ans.eb(4 * k+1);
        ans.eb(4 * k+2);
        ans.eb(4 * k+3);
    }
    if (n%4==0)
    {
        ans.eb(1e5 + 4);
        ans.eb(1e5 + 5);
        ans.eb(1);
        ans.eb(x);
    }
    if (n%4==1){
        ans.eb(x);
    }
    if (n%4==2){
        ans.eb(x ^ 1);
        ans.eb(1);
    }
    if (n%4==3){
        ans.eb(x ^ 1);
        ans.eb(1e5 + 4);
        ans.eb(1e5 + 5);
    }
    sort(all(ans));
    rep(i, n) cout << ans[i] << ENDL;
}
0