 # VALIDMIN-EDITORIAL

Setter: abhi_inav
Testers: iceknight1093 , jeevanjyot
Editorialist: kiran8268

1132

None

# PROBLEM:

There are 3 hidden numbers A, B , C
Given the values of min(A, B), min(B, C), min(C,A). Determine whether there exists any tuple (A, B, C) that satisfies the given values of min(A, B), min(B, C), min(C, A).

# EXPLANATION:

Read the inputs to an array and sort them.
Let the sorted elements be a, a and a.
If a=a , output YES else NO.

# TIME COMPLEXITY:

Time complexity is O(1).

# SOLUTION:

Editorialist's Solution
``````int t;
cin >> t;
while(t--)
{
int a;
for(int i=0;i<3;i++)
{
cin>>a[i];
}

sort(a, a + 3);
if(a == a)
cout << "YES"<<"\n";

else cout << "NO"<<"\n";

}
``````
1 Like

In Explanation section it is given in test case 3 that “One valid tuple (A,B,C) is (4,2,5).”
but using editorialist’s solution we get NO as an answer why?

Hello friend, actually a=min(A,B) , a=min(B,C) and a=min(C,A) and tuple (A,B,C)=(4,2,5) satisfies this as min(4,2)=2=a, min(2,5)=2=a and therefore a=a. Hence the answer should be YES. Hope you have understood 2 Likes

could you please, explain why do we need to sort
my approach: as it was minimum and going circularly , there will be two or more elements which are always same. if a==a or a==a or a==a , then it is a valid tuple.
please correct me if i am wrong

4 Likes

if a==a or a==a or a==a