#E. E - K-colinear Line

    传统题 1000ms 256MiB

E - K-colinear Line

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

E - K-colinear Line

Score : $500$ points

Problem Statement

You are given $N$ points in the coordinate plane. For each $1\leq i\leq N$, the $i$-th point is at the coordinates $(X_i, Y_i)$.

Find the number of lines in the plane that pass $K$ or more of the $N$ points.
If there are infinitely many such lines, print Infinity.

Constraints

  • $1 \leq K \leq N \leq 300$
  • $\lvert X_i \rvert, \lvert Y_i \rvert \leq 10^9$
  • $X_i\neq X_j$ or $Y_i\neq Y_j$, if $i\neq j$.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK

X1X_1 Y1Y_1

X2X_2 Y2Y_2

\vdots

XNX_N YNY_N

Output

Print the number of lines in the plane that pass $K$ or more of the $N$ points, or Infinity if there are infinitely many such lines.


5 2
0 0
1 0
0 1
-1 0
0 -1
6

The six lines $x=0$, $y=0$, $y=x\pm 1$, and $y=-x\pm 1$ satisfy the requirement.
For example, $x=0$ passes the first, third, and fifth points.

Thus, $6$ should be printed.


1 1
0 0
Infinity

Infinitely many lines pass the origin.

Thus, Infinity should be printed.

2024暑假入门组刷题营第三期(十)

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-7-18 13:00
结束于
2024-7-18 15:00
持续时间
2 小时
主持人
参赛人数
8