#P2280. [HNOI2003] 激光炸弹
[HNOI2003] 激光炸弹
Description
A new type of laser bomb can destroy all targets inside a square with side length . There are targets on the map. Integers and denote the position of a target on the map, and each target has a value . The bomb is aimed via satellite, but it has a drawback: the blast square, i.e., the square of side length , must have its sides parallel to the x-axis and y-axis. If a target lies on the boundary of the blast square, it will not be destroyed.
Your task is to compute the maximum total value of targets that a single bomb can destroy.
Multiple targets may be located at the same position.
Input Format
The first line contains integers and .
Each of the next lines contains three integers , denoting a target’s coordinates and its value.
Output Format
Output a single positive integer, the maximum total value of targets that can be destroyed by one bomb (the result does not exceed 32767).
2 1
0 0 1
1 1 1
1
Hint
- Constraints
- For of the testdata, it is guaranteed that , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号