# Torch Lighting - Indicative time limit: 1.0 seconds (reference environment: [environment and measurements](../../../docs/评测环境与性能.md)) - Actual time limit: twice the reference program's baseline time on the slowest official test file in the target environment, rounded up to a multiple of 0.5 seconds; round up further if the platform requires a coarser unit. - Memory limit: 128 MB ## Story The village chief has opened a new farm and wants to illuminate it with torches to prevent monsters from spawning. Some locations contain dark sources that reduce brightness. Every source has a limited range. Count the cells where monsters may still spawn after all sources take effect. ## Formal Problem Statement The farm is an $n$-row, $m$-column grid with rows and columns numbered from $1$ . Position $(i,j)$ has light value $L_{i,j}$ , radius $R_{i,j}$ , and spawn threshold $D_{i,j}$ . Every cell initially has brightness zero. Source $(i,j)$ adds $L_{i,j}$ to every farm cell $(x,y)$ satisfying $$|x-i|+|y-j|