1385A - Three Pairwise Maximums - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

for _ in range(int(input())):
    x,y,z=map(int,input().split())
    l=[x,y,z]
    l.sort();
    if(l[1]!=l[2]):
        print("NO")
    else:
        print("YES")
        print(min([x,y,z]),min([x,y,z]),max([x,y,z]))
    

C++ Code:

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t,x,y,z,a,b,c;
    cin >> t;
    while(t--)
    {
        int a[3];
        cin >> a[1] >> a[2] >> a[3];
        sort(a + 1, a + 3 + 1);
        if(a[1] == a[2] && a[1] == a[3])
        {
            cout << "YES" <<endl;
            cout << a[1] << ' ' << a[2] << ' ' << a[3] << endl;
        }
        else if(a[2] == a[3])
        {
            cout << "YES" <<endl;
            cout << 1 << ' ' << a[1] << ' ' << a[3] << endl;
        }
        else cout << "NO" << endl;
    }
    return 0;
}

	 					 	   	 	 	 					 	 		


Comments

Submit
0 Comments
More Questions

Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number