Square Fishing Net
InterviewTime limit1sMemory limit1024 MB
Given n fish points and a net side length s, find the most fish that one axis-aligned square of side s can cover, boundary included.
- Level
Easy3 of 10
- Topics
- Brute force, Implementation
- Solved
- No attempts yet
Problem
With so many activities and events held online these days, we are going on a virtual fishing trip!
Given the coordinates of points (each point is a fish) and a square (the fishing net), what is the maximum number of fish you can catch with one try? You can place the net anywhere, but its sides must be parallel to the X-axis and the Y-axis. A fish is caught if it is inside or on the boundary of the net.
Input
The first line contains two integers and . Here () is the length of one side of the net, and () is the number of fish. Each of the next lines contains the integer coordinates of one fish, each between 1 and 100 inclusive. No two fish are at the same location.
Output
Print the maximum number of fish you can catch.