cswork / OA打开练习工作台

IntuitOA #22

Spreading Fire (Intuit India)

简单可在线判题

考点(AI 标注)位运算模拟/实现

There are K burning lattice points in a rectangular plane. Fire spreads outward from each origin as a circle: at t=1 the radius is R, and it grows by R every unit of time after that. Find the number of integer lattice points not touched by any fire at time T.

输入格式

The first line contains N M K; the next K lines contain fire coordinates x y; the last line contains R T. Per the problem's example, the integer lattice points include the boundary, i.e., 0≤x≤N, 0≤y≤M. Site limits: 1≤N,M≤100, 1≤K≤100, 0≤R,T≤100, and every fire coordinate lies within the lattice range above.

输出格式

Output the number of integer lattice points not touched by fire. A point whose distance to any fire is less than or equal to R×T counts as touched.

样例 1

输入:

4 4 2
1 1 3 3
1 2

输出:

6

样例 2

输入:

1 1 1
0 0
1 1

输出:

1

样例 3

输入:

1 1 1
0 0
0 10

输出:

3

样例说明

The boundary points enumerated in the problem's example show that the plane has (N+1)×(M+1) integer lattice points in total; points on a circle also count as touched. This site added input ranges to keep the enumeration time manageable.