Skip to content

Commit 37a7406

Browse files
committed
Add Fair Playoff Codeforces Solution
1 parent 35892cb commit 37a7406

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

Arrays/Fair Playoff.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* Example:
2+
3+
Input:
4+
4
5+
3 7 9 5
6+
4 5 6 9
7+
5 3 8 1
8+
6 5 3 2
9+
10+
Output:
11+
YES
12+
NO
13+
YES
14+
NO
15+
*/
16+
17+
#include<iostream>
18+
using namespace std;
19+
20+
int main()
21+
{
22+
long int T;
23+
cin>>T;
24+
25+
while(T--)
26+
{
27+
int s[4], i, f1 = 0, f2 = 0,sm = 0, no = 0, yes = 0;
28+
for(i = 0; i < 4; i++)
29+
cin>>s[i];
30+
31+
if(s[0] > s[1])
32+
f1 = s[0];
33+
34+
else
35+
f1 = s[1];
36+
37+
if(s[2] > s[3])
38+
f2 = s[2];
39+
40+
else
41+
f2 = s[3];
42+
43+
44+
if(f2 - f1 > 0)
45+
sm = f1;
46+
else
47+
sm = f2;
48+
49+
50+
for(i = 0; i < 4; i++)
51+
{
52+
if(s[i] > sm)
53+
yes++;
54+
else
55+
no++;
56+
}
57+
if(yes == 1)
58+
cout<<"YES"<<endl;
59+
else
60+
cout<<"NO"<<endl;
61+
}
62+
return 0;
63+
}

0 commit comments

Comments
 (0)