33OJ
登录 注册

G. 分割点凸包 / Division Point Hull

    传统题 4000ms 256MiB

分割点凸包 / Division Point Hull

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

Problem Statement

There are NN points P1,P2,…,PNP_1,P_2,\dots,P_N on the coordinate plane. The coordinates of point PiP_i are (Xi,Yi)(X_i,Y_i).

You are given positive integers p,qp,q. Let Qi,jQ_{i,j} be the point that internally divides the segment PiPjP_iP_j in the ratio p:qp:q. In particular, if Pi=PjP_i=P_j, then Qi,j=PiQ_{i,j}=P_i.

Find the area of the convex hull of Qi,jQ_{i,j} for all pairs of positive integers (i,j)(i,j) satisfying 1≤i<j≤N1 \leq i \lt j \leq N.

Constraints

  • 2≤N≤1052 \leq N \leq 10^5
  • 1≤p<q≤101 \leq p \lt q \leq 10
  • ∣Xi∣≤107|X_i|\leq 10^7
  • ∣Yi∣≤107|Y_i|\leq 10^7
  • All input values are integers.

Input

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

  • NN pp qq
  • X1X_1 Y1Y_1
  • X2X_2 Y2Y_2
  • ⋮\vdots
  • XNX_N YNY_N

Output

It can be proved that, under the constraints of this problem, the area of the convex hull to be found is rational. When the area is represented as an irreducible fraction xy (x≥0,y≥1)\dfrac{x}{y}\ (x \geq 0, y \geq 1), output xx and yy in this order, separated by a space, in one line.

4 1 2
-2 4
1 1
-3 -2
4 0
59 6

We have $Q_{1,2}=\left(-1,3\right),Q_{1,3}=\left(-\frac{7}{3},2\right),Q_{1,4}=\left(0,\frac{8}{3}\right),Q_{2,3}=\left(-\frac{1}{3},0\right),Q_{2,4}=\left(2,\frac{2}{3}\right),Q_{3,4}=\left(-\frac{2}{3},-\frac{4}{3}\right)$.

Their convex hull is the pentagon formed by connecting Q1,2,Q1,3,Q3,4,Q2,4,Q1,4Q_{1,2},Q_{1,3},Q_{3,4},Q_{2,4},Q_{1,4} in this order, and its area is 596\frac{59}{6}.

Figure

3 3 4
11 -7
2 8
-4 18
0 1

The area of the convex hull may be 00.

10 5 7
-3677189 -8603516
3324282 8371380
-4445534 -865546
-1235744 -6761030
2732080 -9194939
8510740 4384715
-7326815 2451526
-2079912 1054509
2072791 -8408897
-4437202 -5184973
6746232144385823 48

ABC478 赛后模拟赛 ✅️

未参加
状态
已结束
规则
IOI
题目
7
开始于
2026-10-10 21:40
结束于
2026-10-24 21:40
持续时间
336 小时
主持人
参赛人数
59