benchmarks.wiki / Public workspace

Humanity's Last Code Exam / 2020_F / Ley Lines

Problem

Answer published by the source. Consult the official source to check your work against its answer.

platform

atcoder

question content

## Problem Description In 1921, the amateur archaeologist Alfred Watkins coined the term “ley lines” to refer to straight lines between numerous places of geographical and historical interest. These lines have often been associated with mysterious and mystical theories, many of which still persist. One of the common criticisms of ley lines is that lines one draws on a map are actually of non-zero width, and finding “lines” that connect multiple places is trivial, given a sufficient density of points and a sufficiently thick pencil. In this problem, you will explore that criticism. For simplicity, we will ignore the curvature of the earth and just assume we are dealing with a set of points on a plane, each of which has a unique (x,y)(x, y) coordinate, and no three of which lie on a single straight line. Given such a set, and the thickness of your pencil, what is the largest number of points through which you can draw a single line? **Input** The first line of input consists of two integers n n and t t , where n n (3n3000)(3 \leq n \leq 3000) is the number of points in the set and t t (0t109)(0 \leq t \leq 10^9) is the thickness of the pencil. Then follow n n lines, each containing two integers x x and y y (109x,y109)(-10^9 \leq x, y \leq 10^9), indicating the coordinates of a point in the set. You may assume that the input is such that the answer would not change if the thickness t t was increased or decreased by 102 10^{-2} , and that no three input points are collinear. **Output** Output the maximum number of points that lie on a single “line” of thickness t t . **Sample Input 1**
Plain-text mathematical notation (without MathML)
## Problem Description

In 1921, the amateur archaeologist Alfred Watkins coined the term “ley lines” to refer to straight lines between numerous places of geographical and historical interest. These lines have often been associated with mysterious and mystical theories, many of which still persist.

One of the common criticisms of ley lines is that lines one draws on a map are actually of non-zero width, and finding “lines” that connect multiple places is trivial, given a sufficient density of points and a sufficiently thick pencil. In this problem, you will explore that criticism.

For simplicity, we will ignore the curvature of the earth and just assume we are dealing with a set of points on a plane, each of which has a unique (x,y) coordinate, and no three of which lie on a single straight line. Given such a set, and the thickness of your pencil, what is the largest number of points through which you can draw a single line?

**Input**

The first line of input consists of two integers n and t, where n (3≤n≤3000) is the number of points in the set and t (0≤t≤10⁹) is the thickness of the pencil. Then follow n lines, each containing two integers x and y (−10⁹≤x,y≤10⁹), indicating the coordinates of a point in the set.

You may assume that the input is such that the answer would not change if the thickness t was increased or decreased by 10^(−2), and that no three input points are collinear.

**Output**

Output the maximum number of points that lie on a single “line” of thickness t.

**Sample Input 1**
Original LaTeX notation
## Problem Description

In 1921, the amateur archaeologist Alfred Watkins coined the term “ley lines” to refer to straight lines between numerous places of geographical and historical interest. These lines have often been associated with mysterious and mystical theories, many of which still persist.

One of the common criticisms of ley lines is that lines one draws on a map are actually of non-zero width, and finding “lines” that connect multiple places is trivial, given a sufficient density of points and a sufficiently thick pencil. In this problem, you will explore that criticism.

For simplicity, we will ignore the curvature of the earth and just assume we are dealing with a set of points on a plane, each of which has a unique \((x, y)\) coordinate, and no three of which lie on a single straight line. Given such a set, and the thickness of your pencil, what is the largest number of points through which you can draw a single line?

**Input**

The first line of input consists of two integers \( n \) and \( t \), where \( n \) \((3 \leq n \leq 3000)\) is the number of points in the set and \( t \) \((0 \leq t \leq 10^9)\) is the thickness of the pencil. Then follow \( n \) lines, each containing two integers \( x \) and \( y \) \((-10^9 \leq x, y \leq 10^9)\), indicating the coordinates of a point in the set.

You may assume that the input is such that the answer would not change if the thickness \( t \) was increased or decreased by \( 10^{-2} \), and that no three input points are collinear.

**Output**

Output the maximum number of points that lie on a single “line” of thickness \( t \).

**Sample Input 1**

Code

4 2
0 0
2 4
4 9
3 1

**Sample Output 1**

Code

3

**Sample Input 2**

Code

3 1
0 10
2000 10
1000 12

**Sample Output 2**

Code

2

question title

Ley Lines

Discussion

Discussion

No discussion posts on this page yet. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

Source and history

Official source

initial import