Skip to content
Discussion options

You must be logged in to vote

We need to count the number of pairs of points (A, B) such that point A is in the upper left position relative to point B, and there are no other points within the rectangle formed by A and B, including its borders.

Approach

  1. Check Valid Pairs: For each pair of distinct points (A, B), verify if A is in the upper left position relative to B. This means that the x-coordinate of A must be less than or equal to the x-coordinate of B, and the y-coordinate of A must be greater than or equal to the y-coordinate of B. Additionally, there must be at least one strict inequality to ensure the points are distinct in either the x or y direction.
  2. Check for Other Points: For each valid pair (A, B), chec…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Sep 2, 2025
Maintainer Author

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Sep 2, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Sep 2, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants