Bitvzhuh

시간 제한1초메모리 제한2048 MB

요약
서로 다른 k비트 정수 집합이 주어질 때, 모든 쌍의 XOR을 반복해서 취하면 결국 1부터 2^k - 1까지의 모든 값을 포함하게 되는지 판정한다.
난이도

어려움10점 중 9점

유형
비트 연산, 수학, 조합론
정답자
아직 제출이 없습니다

문제

Daniyar recently learned a new spell called "Bitvzhuh". Although it is a very high level spell, Daniyar was able to master it completely and unlock its deepest secrets.

"Bitvzhuh", when cast on a set of integers, transforms the set into a new set which contains the XORs of all pairs in the initial set.

Formally, say you have a set A=a_1,a_2,…,a_nA = \\{a\_1, a\_2, \ldots, a\_n\\} of size nn. After one "Bitvzhuh", AA turns into the set a_i⊕a_j∣1≤i<j≤n\\{a\_i \oplus a\_j \mid 1 \le i < j \le n\\}, where ⊕\oplus denotes the bitwise XOR operation.

Given the initial set and the number kk, find out if Daniyar can apply "Bitvzhuh" a certain non-zero number of times so that the resulting set will contain each integer in the range \[1,2k−1]\[1, 2^k - 1].

입력

The first line contains two integers nn and kk (3≤n≤1063 \le n \le 10^6, 2≤k≤622 \le k \le 62): the size of the initial set and the parameter.

The second line contains nn distinct integers a_1,a_2,…,a_na\_1, a\_2, \ldots, a\_n (1≤a_i<2k1 \le a\_i < 2^k): the elements of the initial set.

출력

Print a single line with the word "Yes" if the set will contain each integer in the range \[1,2k−1]\[1, 2^k - 1] after a certain non-zero number of casts of "Bitvzhuh". Otherwise, print a single line with the word "No".

힌트

In the first example, the answer is achieved after two casts:

1,2,3,4→1,2,3,5,6,7→1,2,3,4,5,6,7\\{1, 2, 3, 4\\} \rightarrow \\{1, 2, 3, 5, 6, 7\\} \rightarrow \\{1, 2, 3, 4, 5, 6, 7\\}.

In the second example, the first cast turns the set 1,2,4,7\\{1, 2, 4, 7\\} into 3,5,6\\{3, 5, 6\\}, and it never changes after.

예제2

  1. 예제 1

    입력
    4 3
    1 2 3 4
    
    예상 출력
    Yes
    
  2. 예제 2

    입력
    4 3
    1 2 4 7
    
    예상 출력
    No