QOJ.ac

QOJ

Total points: 100 Output Only

#8738. Sterilization Plan

Statistics

Dongdong has a beautiful box in the shape of a convex polyhedron. Each face of this box is made of a thin, transparent glass wall in the shape of a convex polygon.

Every once in a while, Dongdong uses a laser emitter to sterilize his box. The laser emitter can emit a beam of laser light. When the laser hits the glass wall of the box, it kills the bacteria on both the inside and outside of the wall. At the same time, a large amount of light is transmitted through the glass, and a small amount of light is reflected by the glass. The light transmitted through the glass continues in its original direction, while the reflected light follows the law of specular reflection: the reflected ray, the incident ray, and the normal to the surface at the point of incidence all lie in the same plane; the reflected ray and the incident ray are on opposite sides of the normal; and the angle of reflection (the angle between the reflected ray and the normal) is equal to the angle of incidence (the angle between the incident ray and the normal).

We consider that the energy of the laser after being reflected $k$ times by the glass is insufficient to kill bacteria (even if multiple such rays hit the glass wall simultaneously, they cannot kill bacteria), while any bacteria hit by the laser before the $k$-th reflection will be killed.

The emission aperture of the laser emitter is triangular. When the laser is fired, the entire aperture emits laser light.

Given the positions of the box and the laser emitter, Dongdong wants to know the total area of the bacteria on the glass walls of the box that are killed. Since the bacteria on the inside and outside of the box are necessarily killed or not killed at the same time, we only need to calculate the area of the killed bacteria on the outside.

Note: The laser or the reflected laser may be parallel to some surfaces, but the data for this problem guarantees that the laser or the reflected laser will not hit any surface to which it is parallel.

Input

This is an "answer submission" type problem. All input data box1.in ~ box10.in are provided. Each input satisfies the following format, with each pair of numbers separated by a space:

The first line contains three integers $n, m, k$, representing the number of vertices of the box, the number of faces of the box, and the number of laser reflections, respectively.

The next $n$ lines each contain three real numbers $x_i, y_i, z_i$, representing the coordinates of the $i$-th vertex of the box.

The next $m$ lines each describe a face of the box. The first number $t_j$ in each line represents the number of vertices of the polygon for that face, followed by $t_j$ integers representing the indices of the box vertices corresponding to these $t_j$ vertices, given in clockwise or counter-clockwise order.

The next three lines each contain 3 integers $x, y, z$, representing the coordinates of the vertices of the laser emitter's aperture.

The next line contains 3 integers $\Delta x, \Delta y, \Delta z$, representing that the direction of the emitted laser is along the vector $(\Delta x, \Delta y, \Delta z)$.

Output

For the given 10 input files box1.in ~ box10.in, you need to submit your output files box1.out ~ box10.out respectively. Each output file contains a single real number, rounded to two decimal places, representing the area of the killed bacteria. When a surface is hit multiple times, the area of this surface is counted only once.

Examples

Input 1

8 6 1
0.0 0.0 0.0
0.0 0.0 1.0
0.0 1.0 1.0
0.0 1.0 0.0
1.0 0.0 0.0
1.0 0.0 1.0
1.0 1.0 1.0
1.0 1.0 0.0
4 2 3 7 6
4 5 6 7 8
4 1 2 3 4
4 1 2 6 5
4 4 3 7 8
4 1 4 8 5
2.0 0.33 0.25
2.0 0.67 0.25
2.0 0.33 0.75
-1.0 0.0 0.0

Output 1

0.17

Note

The sample data is shown in the figure below. The box is a cube. The laser is emitted from the right side, hits the right face, and is transmitted through the right face to hit the left face, killing the bacteria in the two triangular regions on the left and right faces. After hitting the left and right faces, the laser will reflect, but since $k=1$, the reflected rays can no longer kill bacteria, so they do not need to be considered.

The figure shows the box, the laser emitter, the laser direction, and the illuminated regions.


or upload files one by one:

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.