結果

問題 No.862 XORでX
ユーザー tarattata1tarattata1
提出日時 2019-08-09 22:57:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,350 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 72,240 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-26 21:36:25
合計ジャッジ時間 5,702 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    int n,x;
    scanf("%d%d", &n, &x);

    int k=(n-1)%4;

    if(k==0) {
        //nothing
    }
    else if(k==1) {
        printf("1\n");
        x = (x^1);
    }
    else if(k==2) {
        printf("1\n");
        printf("2\n");
        x = ((x^1)^2);
    }
    else if(k==3) {
        printf("1\n");
        printf("2\n");
        printf("3\n");
    }
    printf("%d\n", x);

    int n2=n-k-1;

    if(n2>0) {
        assert(n2%4==0);
        int i;
        int cnt=0;
        for(i=1; i<=n2+1; n2++) {
            int t;
            for(t=0; t<4; t++) {
                if(i*4+t==x) break;
            }
            if(t==4) {
                for(t=0; t<4; t++) {
                    printf("%d\n", i*4+t);
                }
                cnt++;
            }
            if(cnt==n2) break;
        }
    }
    
    return 0;
}
0