CF144B.Meeting
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Super Duper Secret Meeting of the Super Duper Secret Military Squad takes place in a Super Duper Secret Place. The place is an infinite plane with introduced Cartesian coordinate system. The meeting table is represented as a rectangle whose sides are parallel to the coordinate axes and whose vertexes are located at the integer points of the plane. At each integer point which belongs to the table perimeter there is a chair in which a general sits.
Some points on the plane contain radiators for the generals not to freeze in winter. Each radiator is characterized by the number r__i — the radius of the area this radiator can heat. That is, if the distance between some general and the given radiator is less than or equal to r__i, than the general feels comfortable and warm. Here distance is defined as Euclidean distance, so the distance between points (_x_1, _y_1) and (_x_2, _y_2) is 
Each general who is located outside the radiators' heating area can get sick. Thus, you should bring him a warm blanket. Your task is to count the number of warm blankets you should bring to the Super Duper Secret Place.
The generals who are already comfortable do not need a blanket. Also the generals never overheat, ever if they are located in the heating area of several radiators. The radiators can be located at any integer points on the plane, even inside the rectangle (under the table) or on the perimeter (directly under some general). Even in this case their radius does not change.
超级超级秘密军事小队的超级超级秘密会议在一处超级超级秘密地点举行。该地点是一个引入了笛卡尔坐标系的无限平面。会议桌被表示为一个边与坐标轴平行、且四个顶点均位于平面上整数坐标点的矩形。在属于该矩形周长的所有整数坐标点上,均放置有一把椅子,每把椅子上坐着一名将军。
平面上某些点处安装有暖气片,以防止将军们在冬季受冻。每个暖气片由一个数值 ri 表征——即该暖气片所能加热区域的半径。换言之,若某位将军与该暖气片之间的距离小于或等于 ri,则该将军会感到舒适和温暖。此处的距离定义为欧几里得距离,即点 (x1,y1) 与点 (x2,y2) 之间的距离为

任何位于所有暖气片加热范围之外的将军都可能生病,因此你需要为其准备一条保暖毛毯。你的任务是计算需要带到超级超级秘密地点的保暖毛毯总数。
已经感到舒适的将军无需毛毯。此外,将军永远不会中暑,即使其同时处于多个暖气片的加热范围内。暖气片可置于平面上任意整数坐标点处,包括矩形内部(桌子下方)或矩形周长上(正位于某位将军正下方)。即便如此,其加热半径 ri 亦保持不变。
输入格式
The first input line contains coordinates of two opposite table corners x__a, y__a, x__b, y__b (x__a ≠ x__b, y__a ≠ y__b). The second line contains integer n — the number of radiators (1 ≤ n ≤ 103). Then n lines contain the heaters' coordinates as "x__i y__i r__i", the numbers are separated by spaces. All input data numbers are integers. The absolute value of all coordinates does not exceed 1000, 1 ≤ r__i ≤ 1000. Several radiators can be located at the same point.
第一行输入包含桌子两个对角顶点的坐标 xa、ya、xb、yb(满足 xa=xb 且 ya=yb)。
第二行输入一个整数 n —— 暖气片的数量(1≤n≤103)。
接下来 n 行,每行包含一个暖气片的坐标信息:“xi yi ri”,各数字之间以空格分隔。
所有输入数据均为整数;所有坐标的绝对值均不超过 1000,且 1≤ri≤1000。
多个暖气片可以位于同一点。
输出格式
Print the only number — the number of blankets you should bring.
输出唯一的数字——你需要携带的毯子数量。
输入输出样例
输入#1
2 5 4 2 3 3 1 2 5 3 1 1 3 2
输出#1
4
输入#2
5 2 6 3 2 6 2 2 6 5 3
输出#2
0
说明/提示
In the first sample the generals are sitting at points: (2, 2), (2, 3), (2, 4), (2, 5), (3, 2), (3, 5), (4, 2), (4, 3), (4, 4), (4, 5). Among them, 4 generals are located outside the heating range. They are the generals at points: (2, 5), (3, 5), (4, 4), (4, 5).
In the second sample the generals are sitting at points: (5, 2), (5, 3), (6, 2), (6, 3). All of them are located inside the heating range.
在第一个样例中,将军们坐在以下位置:(2, 2)、(2, 3)、(2, 4)、(2, 5)、(3, 2)、(3, 5)、(4, 2)、(4, 3)、(4, 4)、(4, 5)。其中,有 4 名将军位于供暖范围之外,他们的位置分别是:(2, 5)、(3, 5)、(4, 4)、(4, 5)。
在第二个样例中,将军们坐在以下位置:(5, 2)、(5, 3)、(6, 2)、(6, 3)。他们全部位于供暖范围之内。
输入解题思路,AI测评打分。不知道怎么写?