#P10913. [蓝桥杯 2024 国 B] 套手镯

    ID: 12368 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>贪心2024优先队列双指针 two-pointer蓝桥杯国赛

[蓝桥杯 2024 国 B] 套手镯

Problem Description

Xiaolan discovered a bracelet nesting game at the LQ market. On a rectangular plane of size 108×10810^8 \times 10^8, there are NN circular bracelets placed. The player can place a rectangular frame of size w×hw \times h on this plane (the player may only place the frame horizontally/vertically, meaning the frame can be rotated by 9090 degrees, but cannot be rotated to any other angle). The bracelets located inside this rectangular frame are the player’s reward.

You can view this rectangular plane as a 2D coordinate system, with the bottom-left corner at (0,0)(0, 0). The thickness of the bracelets and the frame can be ignored, and multiple bracelets are allowed to overlap.

Xiaolan wants to try once. What is the maximum number of bracelets he can obtain?

Input Format

The first line contains three integers NN, ww, and hh.

Then follow NN lines, each containing three integers x,y,rx, y, r, representing the center coordinates and radius of the ii-th bracelet.

Output Format

Output one integer representing the answer.

8 12 9
18 22 1
3 17 2
21 28 1
7 18 2
10 2 2
4 24 2
19 13 1
14 15 1
3

Hint

Sample Explanation

The figure above shows one possible answer.

Test Case Size and Constraints

For 50%50\% of the testdata: 1N1001 \le N \le 100, 1w,h,x,y,r2001 \le w, h, x, y, r \le 200.
For 100%100\% of the testdata: 1N10001 \le N \le 1000, 1w,h,x,y,r1081 \le w, h, x, y, r \le 10^8, 1min{w,h}2001 \le \min\{w, h\} \le 200. It is guaranteed that all bracelets are inside the plane.

Translated by ChatGPT 5