백준 2468 - 안전영역
import sys sys.setrecursionlimit(10000) dx = [-1,1,0,0] dy = [0,0,-1,1] def DFS(x,y,height): global count VIS[x][y] = True if GRAPH[x][y] > height: count+=1 #GRAPH[x][y] = -1 for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 height and VIS[i][j] == False: DFS(i,j,height) NUM_HOUSE_PER_COMPONENT.append((height,count)) #print(NUM_HOUSE_PER_COMPONENT) ANS.append(len(NUM_HOUSE_PER_COMPONENT)) #p..