Special circles

1

6 votes
Maximum Bipartite Matching, Algorithms, Graphs
Problem

In a binary list, the small positions are called bino positions. Each bino position has a favorite number. A favorite number of the ith bino with fni. The ith bino is better than the jth bino if and only if the number of 1 in the binary representation of (fni|fnj)fni is odd. 

A special circle contains at least two positions where the left bino is better than the other. The next bino is in the clockwise direction. 

Your task is to divide the binos into several groups so that the members of each group can form a special circle.rm a lovely circle.

Input format

  • First line: An integer n denoting the number of binos (1n5000)
  • Next line: n space-separated integers where the ith integer is fni denotes the favorite number of the ith bino (0fni<230)

Output format

If you cannot divide the binos, print 'NO'. Otherwise, print 'YES'.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the first sample, both bino think they are better than the other. Therefore They can form the lovely circle together.


In the second sample, there is no way for Jenny to do what she wants.

Editor Image

?