#P15605. [ICPC 2021 Jakarta R] Energy Generation
[ICPC 2021 Jakarta R] Energy Generation
题目描述
You are given a particle collision energy generator. The generator is a two-dimensional field with towers. The tower is located at position , and all towers have the same field of effect with a radius of . Each tower radiates types of particles at a fixed configuration. Specifically, each tower radiates each particle , , , and on its own quadrant (area separated by both its x-axis and y-axis) in a clockwise order, respectively. The tower does not radiate any particle at its x-axis or y-axis.
Initially, each tower is oriented at a multiple of angle. Let represents the particles radiated by a tower on its upper right, lower right, lower left, and upper left quadrant, respectively.
- If the tower is oriented at , then it radiates as illustrated in the figure on the right.
- If the tower is oriented at (rotated clockwise from ), then it radiates .
- If the tower is oriented at , then it radiates .
- If the tower is oriented at , then it radiates .
:::align{center}
:::
An interesting phenomenon might occur on the tower when there is a tower such that the following conditions are satisfied.
- ,
- , and
- their Euclidean distance is no larger than .
The interesting phenomenon is as follow. Let be the particle that is radiated by the tower on the quadrant where the tower is located, and be the particle that is radiated by the tower on the quadrant where the tower is located. For simplicity, let's say are the particles radiated by their facing sides.
- If their facing sides are radiating either , , , or , then the tower will generate an interaction energy of .
- If their facing sides are radiating the same particles, , , , or , then the tower will generate an interaction energy of ; in other words, it consumes energy.
- If their facing sides are radiating any one of the remaining possible combination of particles that are not mentioned above, then the tower is not interacting with the tower. In other words, there is no energy generated from this pair of towers.
This phenomenon applies both ways (from each tower's perspective) and stacks indefinitely if there are multiple towers satisfying the conditions.
Here are some examples of the energy generated from a pair of towers.
:::align{center}
:::
Each tower also passively generates its own energy. Initially, each tower generates energy by itself.
You have the option to change the orientation of each tower by rotating it, possibly taking advantage of the interesting phenomenon and increasing the total amount of energy generated. Each rotation in any direction (either CW/clockwise or CCW/counterclockwise) causes the tower to produce less energy passively. A tower that is rotated in any direction will produce energy passively and a tower that is rotated (rotated twice in the same direction) will produce energy (or in other words, consume energy). Note that you can only rotate any tower by a multiple of .
Your task in this problem is to find the maximum amount of total energy that can be generated by changing the orientation of zero or more towers in any way. The total energy generated in a configuration is the sum of energy generated by each tower either passively or due to interaction with another tower in the configuration.
输入格式
Input begins with a line containing integers (; ) representing the number of towers, the radius of effect of all towers, the tower interaction energy constant, and the initial energy passively generated by each tower, respectively. The following lines contain integers (; ) representing the position and the initial orientation of the tower. It is guaranteed that no two towers have the same position.
输出格式
Output contains an integer in a line representing the maximum amount of total energy that can be generated out of all possible configurations of the towers.
3 10 10 15
0 0 0
2 2 180
100 100 180
35
3 10 1 1000
0 0 0
2 2 0
-4 4 180
2998
4 10 1000 1
0 0 0
0 2 90
2 0 180
2 2 270
4002
提示
Explanation for the sample input/output #1
The maximum amount of total generated energy can be obtained by rotating the tower for . No interesting phenomenon can happen on the tower as its Euclidean distance to any other towers is larger than . By not rotating the tower, it generates passive energy. Rotating the tower for will cause it to be oriented at . An interesting phenomenon occurs on the tower and the tower as they satisfy all the conditions and their facing side radiates (or from the tower's perspective). The tower will produce from its passive energy generation and interaction with the tower, while the tower will produce energy. These towers generate a total energy of in this configuration.
Explanation for the sample input/output #2
The maximum amount of total generated energy can be obtained by not doing any rotation. These towers are interacting with each other at their current orientation. The and towers each generates interaction energy while the tower generates interaction energy. Each tower also passively generates energy. The total energy generated in this configuration is .
Explanation for the sample input/output #3
The maximum amount of total generated energy can be obtained by rotating the tower for CCW and the tower for CW. With these rotations, there are only interactions between the and towers, and the and towers due to the interesting phenomenon. The tower generates energy, the tower generates energy, the tower generates energy, and the tower generates energy. The total energy generated in this configuration is .