SMBC 编程竞赛 #2(第 481 场 AtCoder Beginner Contest)
E
最璀璨的星空
Most Brilliant Starry Sky
AtCoder
⌀ 1326
原题
← DF →

最璀璨的星空AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

There are $N$ stars on the $xy$-plane. The $i$-th star is represented as the point with coordinates $(X_i,Y_i)$.

$xy$ 平面上有 $N$ 颗星星。第 $i$ 颗星星表示为坐标为 $(X_i,Y_i)$ 的点。AI (CI翻译)

Draw one line that passes through the origin and does not pass through any star, and choose one of the two regions into which the line divides the plane.

画一条经过原点且不经过任何星星的直线,并选择这条直线将平面分成的两个区域之一。AI (CI翻译)

Find the maximum possible number of stars contained in the chosen region.

求所选区域中星星数量的最大可能值。AI (CI翻译)

You are given $T$ test cases; solve each of them.

给定 $T$ 组测试用例,请分别求解。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \le T \le 2 \times 10^5$
  • $1 \le N \le 2 \times 10^5$
  • The sum of $N$ over all test cases is at most $2 \times 10^5$.
  • $-10^9 \le X_i,Y_i \le 10^9$
  • $(X_i,Y_i) \ne (0,0)$
  • $(X_i,Y_i) \ne (X_j, Y_j) ~ (i \ne j)$
  • No two distinct stars are collinear with the origin.
  • All input values are integers.
  • $1 \le T \le 2 \times 10^5$
  • $1 \le N \le 2 \times 10^5$
  • 所有测试用例中 $N$ 的总和不超过 $2 \times 10^5$。
  • $-10^9 \le X_i,Y_i \le 10^9$
  • $(X_i,Y_i) \ne (0,0)$
  • $(X_i,Y_i) \ne (X_j, Y_j) ~ (i \ne j)$
  • 任意两颗不同的星星都不与原点共线。
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入按以下格式给出:AI (CI翻译)

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T
AI (CI翻译)

Each test case is given in the following format:

每组测试用例按以下格式给出:AI (CI翻译)

N
X_1 Y_1
X_2 Y_2
\vdots
X_N Y_N

N
X_1 Y_1
X_2 Y_2
\vdots
X_N Y_N
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Print $T$ lines. The $i$-th line should contain the answer for the $i$-th test case.

输出 $T$ 行。第 $i$ 行应包含第 $i$ 组测试用例的答案。AI (CI翻译)

样例

Input #1
3
4
2 1
2 -1
-1 2
-2 -3
3
1 0
2 1
3 -2
20
351656128 486890400
43833334 189818465
244758369 410609525
82390518 959687989
37964139 450230904
-27725133 788196612
392638907 -544184247
-305242056 -60014958
-928747557 460755669
-415081310 638281062
307908966 -865172261
580339611 459847409
42654321 -744472144
-286500328 34461456
-874976232 -245368444
462187336 508372206
-229275227 74979882
-180126519 740406850
877877433 -211582842
256315745 -928285605
Output #1
3
3
15
In the $1$-st test case, if you draw the line $y=-x$ and choose the region containing the $1$-st star, that region contains the $1$-st, $2$-nd, and $3$-rd stars. It is impossible to include all $4$ stars, so the answer is $3$. In the $2$-nd test case, if you draw the line $x=0$ and choose the region to its right, all stars are contained.
题目信息
题号
abc481_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。