PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: utkarsh_25dec
Testers: iceknight1093, tabr
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
Given three integers A, B, C; determine if the product of some two of them is negative.
EXPLANATION:
There are only three possible products: A\times B, A\times C, B\times C.
Compute all three of them and check if any of them is negative.
Alternatively, note that a negative product requires one positive and one negative number, so check if at least one of each exists.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
print('Yes' if min(a, b, c) < 0 and max(a, b, c) > 0 else 'No')