Which Mixture solution codechef – Chef has AA units of solid and BB units of liquid

Which Mixture solution codechef

Chef has AA units of solid and BB units of liquid. He combines them to create a mixture. What kind of mixture does Chef produce: a solution, a solid, or a liquid?

A mixture is called a:

1) A solution if A>0A>0 and B>0B>0,

2) A solid if B=0B=0, or

3) A liquid if A=0A=0.

Input Format Which Mixture solution codechef

  • The first line contains TT denoting the number of test cases. Then the test cases follow.
  • Each test case contains two space-separated integers AA and BB on a single line.

Output Format Which Mixture solution codechef

For each test case, output on a single line the type of mixture Chef produces, whether it is a SolutionSolid, or LiquidThe output is case sensitive.

Constraints Which Mixture solution codechef

  • 1T201≤T≤20
  • 0A,B1000≤A,B≤100
  • A+B>0A+B>0

Subtasks Which Mixture solution codechef

  • Subtask 1 (100 points): Original constraints

Sample Input 1  Which Mixture solution codechef

3
10 5
0 3
3 0

Sample Output 1  Which Mixture solution codechef

Solution
Liquid
Solid

Explanation Which Mixture solution codechef

Test case 11: Chef adds both solid and liquid to the mixture, hence the mixture is a solution.

Test case 22: Chef does not add solid to the mixture, hence the mixture is liquid.

Test case 33: Chef does not add liquid to the mixture, hence the mixture is solid.

Only xx hours are left for the March Long Challenge and Chef is only left with the last problem unsolved. However, he is sure that he cannot solve the problem in the remaining time. From experience, he figures out that he needs exactly HH hours to solve the problem.

Which Mixture solution codechef

Now Chef finally decides to use his special power which he has gained through years of intense yoga. He can travel back in time when he concentrates. Specifically, his power allows him to travel to NN different time zones, which are T1,T2,,TNT1,T2,…,TN hours respectively behind his current time.

Find out whether Chef can use one of the available time zones to solve the problem and submit it before the contest ends.

Input Which Mixture solution codechef

  • The first line of the input contains three space-separated integers NNHH and xx.
  • The second line contains NN space-separated integers T1,T2,,TNT1,T2,…,TN.

Output Which Mixture solution codechef

Print a single line containing the string "YES" if Chef can solve the problem on time or "NO" if he cannot.

You may print each character of each string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

Constraints Which Mixture solution codechef

  • 1N1001≤N≤100
  • 1x<H1001≤x<H≤100
  • 1Ti1001≤Ti≤100 for each valid ii

Subtasks Which Mixture solution codechef

Subtask #1 (100 points): original constraints

Example Input 1 Which Mixture solution codechef

2 5 3
1 2

Example Output 1 Which Mixture solution codechef

YES

Explanation Which Mixture solution codechef

Chef already has 33 hours left. He can go to the 22-nd time zone, which is 22 hours back in time. Then he has a total of 3+2=53+2=5 hours, which is sufficient to solve the problem.

Example Input 2 Which Mixture solution codechef

2 6 3
1 2

Example Output 2 Which Mixture solution codechef

NO 

Explanation Which Mixture solution codechef

If Chef goes to the 11-st time zone, he will have 3+1=43+1=4 hours, which is insufficient to solve the problem.

If he goes to the 22-nd time zone, he will have 3+2=53+2=5 hours, which is also insufficient to solve the problem.

Since none of the time travel options can be used to gain sufficient time to solve the problem, Chef is incapable of solving it.

Leave a Reply

Your email address will not be published. Required fields are marked *

*