-
Notifications
You must be signed in to change notification settings - Fork 0
/
1385A-ThreePairwiseMaximums.cpp
85 lines (68 loc) · 1.57 KB
/
1385A-ThreePairwiseMaximums.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* samikshamodi - Samiksha Modi */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);
#define out1d(arr,size) {for(int i=0;i<size;i++) cout<<arr[i]<<" ";}
#define in2d(arr,row,col) for(int i=0;i<row;i++) for(int j=0;j<col;j++) cin>>arr[i][j];
#define out2d(arr,row,col) {for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cout<<arr[i][j]<<" ";cout<<endl;}}
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll N = 1e5 + 7;
void solve()
{
int x, y, z;
int a, b, c;
cin >> x >> y >> z;
if(y == z && y >= x) //then c is greater than both
{
c = y;
a = x;
b = 1;
}
if(max(a, b) == x && max(a, c) == y && max(b, c) == z)
{
cout << "YES\n" << a << " " << b << " " << c;
return;
}
if(x == y && x >= z) //then a is the greatest
{
a = x;
b = 1;
c = z;
}
if(max(a, b) == x && max(a, c) == y && max(b, c) == z)
{
cout << "YES\n" << a << " " << b << " " << c;
return;
}
if(x == z && x >= y) //then b is the greatest
{
b = x;
a = 1;
c = y;
}
if(max(a, b) == x && max(a, c) == y && max(b, c) == z)
{
cout << "YES\n" << a << " " << b << " " << c;
return;
}
cout << "NO";
}
int main()
{
sync;
int t;
cin >> t;
while(t--)
{
solve();
cout << "\n";
}
return 0;
}