GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday 11 May 2022

[Solution] Average Gift CodeChef Solution | CodeChef Problem Solution 2022

Chef has a set S containing N distinct integers.

Chef wants to gift Chefina an array A of any finite length such that the following conditions hold true:

  • AiS i. In other words, each element of the array A should belong to the set S.
  • Mean value of all the elements in A is exactly X.
Solution Click Below:-  CLICK HERE

Find whether there exists an array A of finite length satisfying the above conditions.

Input Format

  • First line will contain T, the number of test cases. Then the test cases follow.
  • First line of each test case contains two integers N and X - denoting the size of set S and the mean value of the required array.
  • Second line contains N distinct integers S1,S2,,SN - denoting the set S.

Output Format

For each test case, output in a single line, YES if there exists an array satisfying the given conditions, NO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings YESyEsyes, and yeS will all be treated as identical).

Constraints

  • 1T1000
  • 1N105
  • 1Si109
  • 1X109
  • SiSj for ij
  • Sum of N over all test case do not exceed 2105.

Join Now for Solution:- 

No comments:

Post a Comment