Problem 1131 --Find the demon[Easy]
1131: Find the demon[Easy]Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 1347 Solved: 282
There were various kinds of demons in Binary Forest. They committed terrible crimes. However, no one saw their faces exactly, the only known thing is the height of every kind (demons for the same kind all share a common height, which is diﬀerent from any other kind). One day, the sheik of the forest asked all men lived in the forest to line up and stand in ascending order of their heights, but he didn't know how to ﬁnd the demons. Could you please help the poor sheik?
The ﬁrst line will be an integer T (100<=T<=1000), which is the number of test cases. For each case have two lines. The ﬁrst line of the input contains two number n and m, n is the number of the men in the forest (1<=n<=106), and m is the demon's height. The second line contains n numbers which are the heights of the men in the forest. You should determine whether demon(s) is(are) among the men or not.
For each case, output only one line. If there is(are) demon(s) among the men, output YES, otherwise output NO.
1 2 3
1 2 3