아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Square Fishing Net

면접 대비

시간 제한1초메모리 제한1024 MB

요약
한 변의 길이가 s인 정사각형을 축에 평행하게 놓아 최대한 많은 물고기 점을 포함할 때 그 개수를 구한다.
난이도

보통10점 중 4점

유형
슬라이딩 윈도우, 완전 탐색, 배열
정답자
아직 제출이 없습니다

문제

With so many activities/events being virtual these days, we are going on a virtual fishing trip!

Given the (x,y) coordinates of n points (each point represents a fish) and a square (representing a fishing net), what is the maximum fish you can catch with one try? You can place the square net anywhere but its sides must be parallel to X-axis and Y-axis. A fish is caught if it is inside or on the boundary of the net.

입력

The first input line contains two integers: s (1 ≤ s ≤ 100), indicating the length of one side of the fishing net and n (1 ≤ n ≤ 100), indicating the number of fish. Each of the next n input lines contains two integers (each between 1 and 100, inclusive) indicating the (x,y) coordinates of one fish. Assume that no two fish are at the same location.

출력

Print the maximum number of fish you can catch.

예제2

  1. 예제 1

    입력
    3 8
    2 1
    2 3
    5 1
    5 2
    3 2
    4 2
    10 5
    11 5
    
    예상 출력
    6
    
  2. 예제 2

    입력
    50 2
    10 5
    11 5
    
    예상 출력
    2