結果
| 問題 | 
                            No.862 XORでX
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gratan_mogmog
                         | 
                    
| 提出日時 | 2019-08-09 22:50:17 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,406 bytes | 
| コンパイル時間 | 1,663 ms | 
| コンパイル使用メモリ | 173,912 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-19 14:58:08 | 
| 合計ジャッジ時間 | 6,065 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 1 WA * 27 | 
ソースコード
#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;
}
            
            
            
        
            
gratan_mogmog