baekjoon 20260307 modify 16946.py

This commit is contained in:
songyc macbook 2026-03-07 22:49:40 +09:00
parent 7b7e92fece
commit 2571466cbc

View File

@ -48,20 +48,10 @@ for x, y in wall :
if 0 <= nx < M and 0 <= ny < N and area_num[ny][nx] != -1 :
area = area_num[ny][nx]
neighbor.append(area)
if len(neighbor) == 0 :
cnt += area_size[area]
neighbor.append(area)
else :
dupli_check = True
for n in neighbor :
if n == area :
dupli_check = False
if dupli_check :
cnt += area_size[area]
neighbor.append(area)
for n in set(neighbor) :
cnt += area_size[n]
res[y][x] = cnt % 10