Skip to content

Latest commit

 

History

History
93 lines (76 loc) · 2.36 KB

statement.md

File metadata and controls

93 lines (76 loc) · 2.36 KB

Problem Statement

平面上に幾つか点(座標は全て整数である)が与えられる。平面上に、最も多くの点を通過するような直線を1本だけ引くとき、通過する点の数を求めよ。

Given some point on a plane surface (coordinate x and y is represented by two integers), calculate the maximum number of points passed by the line which is drawn to pass points as many as possible.

Input

入力は以下の形式で表される。

The input is given with the following format.

D
N1
x11 y11
x12 y12
 :
x1N1 y1N1
N2
x21 y21
x22 y22
:
x2N2 y2N2
:
ND
xD1 yD1
xD2 yD2
:
xDND yDND

ここでDはデータセットの個数である。さらに、i番目のデータセットにおいて、Niは点の個数、xijおよびyijはj番目の点の座標である。

D is a number of data sets. For the ith dataset, Ni is the number of points, xij and yij are a coordinate of jth point.

Constraint

入力は以下の条件をすべて満たす。

  • 1 <= D <= 100
  • 1 <= i <= D を満たすすべての整数iについて、
    • 2 <= Ni <= 50
    • さらに、1 <= j, k <= Ni を満たすすべての整数j, kについて、
      • -100 <= xij <= 100
      • -100 <= yij <= 100
    • j ≠ k ならば (xij, yij) ≠ (xik, yik)

The input satisfies the following constraints.

  • 1 <= D <= 100
  • For i satisfying 1 <= i <= D
    • 2 <= Ni <= 50
    • For j satisfying 1 <= j, k <= Ni
      • -100 <= xij <= 100
      • -100 <= yij <= 100
    • if j ≠ k then (xij, yij) ≠ (xik, yik)

Output

出力は、各データセットごとに直線が通過する点の個数を1行で出力せよ。

Write the maximum number of points passed by a line with respect to each data set.

Sample Input

2
5
0 0
-1 -1
1 1
2 2
3 -3
6
5 0
0 -2
0 1
0 7
1 3
2 4

Sample Output

4
3