[Solution] Valid Minimum solution codechef

Valid Minimum solution codechef – There are 33 hidden numbers A,B,CA,B,C.

You somehow found out the values of min(A,B),min(B,C),min(A,B),min(B,C), and min(C,A)min(C,A).

Table of Contents

[Solution] Valid Minimum solution codechef

Determine whether there exists any tuple (A,B,C)(A,B,C) that satisfies the given values of min(A,B),min(B,C),min(C,A)min(A,B),min(B,C),min(C,A).

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • The first and only line of each test case contains 33 space-separated integers denoting the values of min(A,B),min(B,C),min(A,B),min(B,C), and min(C,A)min(C,A).

Output Format

For each test case, output YES if there exists any valid tuple (A,B,C)(A,B,C), and NO otherwise.

You can print each letter of the output in any case. For example YESyesyEs will all be considered equivalent.

[Solution] Valid Minimum solution codechef

  • 1T10001≤T≤1000
  • 1min(A,B),min(B,C),min(C,A)101≤min(A,B),min(B,C),min(C,A)≤10

Sample Input 1 

3
5 5 5
2 3 4
2 2 4

Sample Output 1 

YES
NO
YES

[Solution] Valid Minimum solution codechef Explanation

Test case 11: One valid tuple (A,B,C)(A,B,C) is (5,5,5)(5,5,5).

Test case 22: It can be shown that there is no valid tuple (A,B,C)(A,B,C).

Test case 33: One valid tuple (A,B,C)(A,B,C) is (4,2,5)(4,2,5).

For Solution

Click Here

Leave a Comment