Now using Pythagorean theorem find if a cell touches or within any circle or not .
for i in range ( m ) : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT for p in range ( k ) : NEW_LINE INDENT if ( math . sqrt ( ( pow ( ( X [ p ] - 1 - i ) , 2 ) + pow ( ( Y [ p ] - 1 - j ) , 2 ) ) ) <= r ) : NEW_LINE INDENT rect [ i ] [ j ] = - 1 NEW_LINE DEDENT DEDENT DEDENT DEDENT