PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: mamaleshrh
Tester: iceknight1093
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
N teams participate in a knockout cricket tournament.
The tournament is interesting if at least M matches are played in total.
Given N and M, is the tournament interesting?
EXPLANATION:
Here’s an interesting observation: a knockout tournament with N teams will always have exactly N-1 matches played!
This is because each match will knock out exactly one team; and the winner will be decided when there’s a single team remaining: in other words, N-1 teams are knocked out (which requires N-1 matches).
So, the answer is Yes
if M \leq N-1, and No
otherwise.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
n, m = map(int, input().split())
print('Yes' if m <= n-1 else 'No')