BGL1211 Editorial

PROBLEM LINK:

Practice

Contest

Author: Pritish Priyatosh Nayak

Tester: Satyabrat Panda

Editorialist: Satyabrat Panda

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

You’re given the end points of two line segments collinear with the X-axis. You’ve to check if they overlap.

EXPLANATION:

Instead of checking whether they overlap or not by using multiple conditions, we can simply check if they don’t overlap using a simple set of conditions.

If L_2 > R_1 or L_1 > R_2 , answer is “normal” , otherwise “good”. Think why it works.

SOLUTIONS:

Setter Solution
Tester’s Solution

1 Like