PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: CodeChef Admin
Preparer: Souradeep Paul
Testers: Takuki Kurokawa, Utkarsh Gupta
Editorialist: Nishank Suresh
DIFFICULTY:
584
PREREQUISITES:
None
PROBLEM:
Alice wants the air conditioner to be set to at least A degrees, Bob wants it to be set to at most B degrees, and Charlie wants it to be set to at least C degrees.
Is there a temperature that satisfies all three?
EXPLANATION
A simple application of if
conditions: note that Alice and Bob can be simultaneously satisfied if and only if A \leq B. Similarly, Charlie and Bob can be simultaneously satisfied if and only if C \leq B.
So,
- The answer is “Yes” if both A \leq B and C \leq B hold
- The answer is “No” otherwise.
TIME COMPLEXITY:
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
print('yes' if max(a, c) <= b else 'no')