結果

問題 No.1456 Range Xor
ユーザー ramia777ramia777
提出日時 2022-06-04 16:59:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 3,027 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 97,048 KB
実行使用メモリ 6,356 KB
最終ジャッジ日時 2023-10-21 02:46:25
合計ジャッジ時間 23,201 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,652 KB
testcase_01 AC 2 ms
5,652 KB
testcase_02 AC 3 ms
5,652 KB
testcase_03 AC 541 ms
6,320 KB
testcase_04 AC 268 ms
6,320 KB
testcase_05 AC 846 ms
6,320 KB
testcase_06 AC 438 ms
6,320 KB
testcase_07 TLE -
testcase_08 AC 1,118 ms
6,320 KB
testcase_09 AC 589 ms
6,320 KB
testcase_10 AC 91 ms
6,320 KB
testcase_11 AC 100 ms
5,788 KB
testcase_12 AC 21 ms
5,708 KB
testcase_13 AC 298 ms
5,896 KB
testcase_14 AC 175 ms
5,892 KB
testcase_15 AC 362 ms
6,288 KB
testcase_16 AC 155 ms
6,240 KB
testcase_17 AC 545 ms
5,984 KB
testcase_18 AC 52 ms
5,884 KB
testcase_19 AC 204 ms
6,124 KB
testcase_20 AC 191 ms
6,236 KB
testcase_21 AC 31 ms
6,112 KB
testcase_22 AC 75 ms
6,136 KB
testcase_23 AC 230 ms
5,916 KB
testcase_24 AC 66 ms
5,760 KB
testcase_25 AC 233 ms
5,864 KB
testcase_26 AC 677 ms
6,020 KB
testcase_27 AC 59 ms
6,184 KB
testcase_28 AC 176 ms
5,836 KB
testcase_29 TLE -
testcase_30 AC 271 ms
6,320 KB
testcase_31 AC 148 ms
5,820 KB
testcase_32 AC 108 ms
5,796 KB
testcase_33 AC 361 ms
5,948 KB
testcase_34 AC 493 ms
6,320 KB
testcase_35 AC 163 ms
6,036 KB
testcase_36 AC 343 ms
6,320 KB
testcase_37 TLE -
testcase_38 AC 72 ms
5,768 KB
testcase_39 AC 181 ms
6,212 KB
testcase_40 AC 1,389 ms
6,204 KB
testcase_41 AC 4 ms
5,664 KB
testcase_42 AC 36 ms
5,732 KB
testcase_43 AC 2 ms
5,652 KB
testcase_44 AC 3 ms
5,652 KB
testcase_45 AC 2 ms
5,652 KB
testcase_46 AC 3 ms
5,652 KB
testcase_47 AC 3 ms
5,652 KB
testcase_48 AC 3 ms
5,652 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> //tree
#include <map> //連想配列
#include <unordered_set> //hash
#include <unordered_map> //hash
#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;


queue<int> _queue;


//昇順
int compare_up(const int * a, const int *b)
{
	if (*a > *b)
		return (1);
	else if (*a < *b)
		return (-1);
	return (0);
}

//降順
int compare_down(const int * a, const int *b)
{
	if (*a > *b)
		return (-1);
	else if (*a < *b)
		return (1);
	return (0);
}


int par[3005 * 3005];  //ルートの番号
int _rank[3005 * 3005]; //木の高さ
int flag[3005 * 3005];

// 経路圧縮
// 直列で連結しているような木はすべて直接ルートにつなぐようにする
int _find(int x)
{

	if (x == par[x])
	{
		//cout << "x=" << x << endl;
		return x;
	}
	else
	{
		int a;
		//cout << "in->" << endl;
		a = _find(par[x]);
		//cout << "<-out" << endl;




		//cout << "x=" << x << ",par[x]=" << par[x] << ",a=" << a << endl;


		//ルートを更新(圧縮)
		par[x] = a;

		//新しいルートを返す
		return par[x];
	}
}

//xとyが同じ集合かどうか
bool same(int x, int y)
{
	//ルートが同じかどうかを判定すればOK
	return	_find(x) == _find(y);
}

//初期化
//はじめは全部の頂点がルート
void init(int n)
{
	for (int i = 0; i < n; i++)
	{
		par[i] = i;
		_rank[i] = 0;
	}
}


// x と y を同じツリーにする
void _union(int x, int y)
{
	int root_x;
	int root_y;

	root_x = _find(x);
	root_y = _find(y);


	if (root_x == root_y) return; //最初から同じルートならすぐ返す


	//木の高さが高いほうの木の根に、低いほうの根をつなげる
	if (_rank[root_x] < _rank[root_y])
	{
		// x<yのとき
		par[root_x] = root_y;
	}
	else
	{
		// x>y または x==y のとき

		// yをxにつなげる
		par[root_y] = root_x;

		// 高さが同じときだけ 高さを変える必要がある
		if (_rank[root_x] == _rank[root_y])
			_rank[root_x]++; // つなげられた木の高さを1つふやす(全体の木の高さは1増える)
	}

}


int N;
ULL K;
ULL A[100005];
ULL B[100005];
int main()
{


	cin >> N;
	cin >> K;

	for (int i=1;i<=N; i++)
	{
		cin >> A[i];

		if (i==0)
		{
			B[i] = A[i];
		}
		else
		{
			B[i] = B[i - 1] ^ A[i];
		}
	}


	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j <= N; j++)
		{
			ULL C = B[j] ^ B[i];
			if (K == C)
			{
				cout << "Yes";
				return 0;
			}
		}
	}
	
	cout << "No";
	return 0;


}

0