結果

問題 No.1456 Range Xor
ユーザー ramia777ramia777
提出日時 2022-06-05 12:16:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 1,430 bytes
コンパイル時間 926 ms
コンパイル使用メモリ 100,064 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-10-21 03:10:05
合計ジャッジ時間 3,496 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 36 ms
8,316 KB
testcase_04 AC 35 ms
8,316 KB
testcase_05 AC 35 ms
8,316 KB
testcase_06 AC 35 ms
8,316 KB
testcase_07 AC 34 ms
8,316 KB
testcase_08 AC 33 ms
8,316 KB
testcase_09 AC 34 ms
8,316 KB
testcase_10 AC 37 ms
8,316 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 3 ms
4,348 KB
testcase_13 AC 12 ms
4,856 KB
testcase_14 AC 11 ms
4,856 KB
testcase_15 AC 25 ms
6,996 KB
testcase_16 AC 24 ms
6,732 KB
testcase_17 AC 15 ms
5,912 KB
testcase_18 AC 11 ms
4,856 KB
testcase_19 AC 21 ms
6,204 KB
testcase_20 AC 24 ms
6,732 KB
testcase_21 AC 19 ms
6,204 KB
testcase_22 AC 19 ms
6,204 KB
testcase_23 AC 11 ms
4,908 KB
testcase_24 AC 6 ms
4,348 KB
testcase_25 AC 11 ms
4,704 KB
testcase_26 AC 19 ms
5,912 KB
testcase_27 AC 22 ms
6,468 KB
testcase_28 AC 9 ms
4,704 KB
testcase_29 AC 32 ms
8,316 KB
testcase_30 AC 32 ms
8,316 KB
testcase_31 AC 8 ms
4,704 KB
testcase_32 AC 6 ms
4,364 KB
testcase_33 AC 12 ms
5,120 KB
testcase_34 AC 31 ms
8,316 KB
testcase_35 AC 16 ms
5,940 KB
testcase_36 AC 33 ms
8,316 KB
testcase_37 AC 31 ms
6,996 KB
testcase_38 AC 6 ms
4,348 KB
testcase_39 AC 21 ms
6,468 KB
testcase_40 AC 23 ms
6,468 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 5 ms
4,348 KB
testcase_43 AC 1 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 AC 2 ms
4,348 KB
testcase_48 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicodr
// No.1456




//二次元可変配列
//vector <vector <int>> mass;
//vector <vector <int>> memo;
//vector <int> memo;


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>//list
#include <queue> //queue
#include <set> //連想コンテナ,O(logN)
#include <map> //連想コンテナ,O(logN)
#include <unordered_set> //hash、O(1)
#include <unordered_map> //hash、O(1)
#include <algorithm>
#include <iomanip>
#include <cstring>
//#include <bits/stdc++.h>

using namespace std;

#define FOR(x,to) for(x=0;x<to;x++)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define FMAX(a,b)  ((a)>(b)?(a):(b))
#define FMIN(a,b)  ((a)<(b)?(a):(b))
#define FCEIL(a,b)  ((a)+(b)-1)/(b)

typedef unsigned long long ULL;
typedef signed long long SLL;





int N;
int K;
int A[100005];
//int B[100005];

unordered_set<int> B;

int main()
{


	cin >> N;
	cin >> K;

	int C = K;

	for (int i=1;i<=N; i++)
	{
		scanf("%d",&A[i]);
         
		C = C ^ A[i]; //Kを初期値とした累積和を計算
		B.insert(C);  //ハッシュに入れる
	}



	C = 0;
	for (int i = 0; i <= N; i++)//0からはじめる
	{
		
		C = C ^ A[i]; //入力された数列の最初からXORを順番にとっていく

		//Cが累積和のどこかの値と同じならKが含まれている
		if (B.count(C))
		{
			cout << "Yes"<< endl;
			return 0;
		}
	}
	
	cout << "No"<<endl;
	return 0;


}

0