PP2: Week 9,10: May 17 - 30
Ardent Butterfly Collector
As you know, Andry Sergeevich is an ardent collector of butterflies. He has a huge collection, the exhibits of which are collected from around the world. We assume that there are 2 *
109 species of butterflies in the world.
In order not to get confused, Andrei Sergeevich assigned a unique number to each species. Butterfly numbering always starts from one. Now he wants to know if there is a butterfly with a number k in his collection, or he will have to get it, spending a lot of effort and money.
First line contains the number of species of butterflies n (1 ≤ n ≤
105) in the collection of Andrei Sergeevich. Next line contains n numbers in ascending order - the numbers of butterfly species in the collection. All kinds of butterflies in the collection have different numbers.
Third line contains the number of species of butterflies m (1 ≤ m ≤
105), about which Andrei Sergeevich wants to know if he has them in the collection or not. The last line contains m numbers - numbers of species of butterflies, the presence of which must be checked.
Print m lines. For each query print "YES", if the butterfly with the given number exists in his collection and "NO" otherwise.
7 10 47 50 63 89 90 99 4 84 33 10 82
NO NO YES NO