PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: iceknight1093
Tester: sushil2006
Editorialist: iceknight1093
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
You’re given L and R.
Does there exist an even integer among the values L, L+1, \ldots, R?
EXPLANATION:
If L \lt R the answer is always Yes, because we have both L and L+1 with us, and one of them is definitely even.
If L = R we only have a single integer with us, so the answer is Yes if and only if it’s even.
Thus,
- If L = R and L is odd, the answer is
No - In every other case the answer is
Yes.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
l, r = map(int, input().split())
if l == r and l%2 == 1: print('No')
else: print('Yes')