# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14222 | Lab1_Binary Search Problem |
|
Description
There is a non-increasing integer array A with nn integers. (The integers may duplicate.)
You are given an array Q with mm integers, each integer denotes a query.
For each query, find if the integer exists in A . If yes, output “Y”. Otherwise, output “N”.
Input
The first line contains two integers n and m — the number of integers in array A and the number of integers in array Q.
The second line contains n integers a1,a2,⋯ ,an — the elements of the array A.
The third line contains m integers q1,q2,⋯ ,qm — the elements of the array Q.
Restrictions
Output
For each query, output “Y” or “N” — the integer of the query is in the array A or not.
Please append a space after each query.