QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#641. 3D Convex Hull - Easy

Statistics

You are given $n$ points in three-dimensional space. The $i$-th point is located at $(x_i,y_i,z_i)$. Find their convex hull, and compute its number of surfaces, surface area, and volume.

The convex hull of a set of points is the smallest convex set containing all of them. A surface means a maximal planar face of its boundary. Coplanar triangles forming one face count as one surface; for example, a cube has six surfaces.

Four or more points may lie in the same plane. If all points lie in a single plane (including when all points are collinear), the hull is degenerate.

Input

The first line contains an integer $n$ ($4 \le n \le 2000$), the number of points.

Each of the next $n$ lines contains three integers $x_i$, $y_i$, and $z_i$ ($|x_i|,|y_i|,|z_i| \le 10^9$), representing the coordinates of the $i$-th point.

All points are distinct.

Output

If the hull is degenerate, output a single line containing no.

Otherwise, output yes on the first line. On the second line, output an integer $F$ and two real numbers $A$ and $V$, separated by spaces: the number of surfaces, the surface area, and the volume, respectively.

The value of $F$ must be exact. Each of $A$ and $V$ is considered correct if its absolute or relative error does not exceed $10^{-9}$. Formally, an answer $a$ and jury answer $b$ satisfy

$$|a-b| \le 10^{-9}\max(1,|b|).$$

Subtasks

Subtask Points Coordinate bound
1 25 $|x_i|,|y_i|,|z_i| \le 10^3$
2 25 $|x_i|,|y_i|,|z_i| \le 10^5$
3 25 $|x_i|,|y_i|,|z_i| \le 10^7$
4 25 $|x_i|,|y_i|,|z_i| \le 10^9$

Each test earns 100% if its entire output is correct, 40% if yes, $A$, and $V$ are correct but $F$ is incorrect, and 0% otherwise. A correct no earns 100% for that test. The score for a subtask is its point value multiplied by the minimum fraction earned over its tests.

Examples

Example 1

Input

4
0 0 0
1 0 0
0 1 0
0 0 1

Output

yes
4 2.366025403784439 0.166666666666667

Example 2

Input

8
0 0 0
1 0 0
0 1 0
1 1 0
0 0 1
1 0 1
0 1 1
1 1 1

Output

yes
6 6 1

Example 3

Input

4
0 0 0
1 0 1
0 1 1
1 1 2

Output

no

Notes

The first sample is a tetrahedron. The second sample is a unit cube: its six square faces count as six surfaces. In the third sample, all points lie in the plane $z=x+y$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.