結果

問題 No.179 塗り分け
ユーザー Mr.Fuku
提出日時 2018-06-26 21:04:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,761 ms / 3,000 ms
コード長 637 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-23 14:49:34
合計ジャッジ時間 6,404 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = input().split()
h,w = int(h),int(w)
lst=[]

def f(plus_index):
    
    dummy = lst[:]
    h_index = lst[plus_index][0]-lst[0][0]
    w_index = lst[plus_index][1]-lst[0][1]
    
    for i in dummy:
        n = [i[0]+h_index,i[1]+w_index]
        if n in dummy:
            dummy.remove(n)
        else:
            return False
    else:
        print("YES")
        return True

for i in range(h):
    for j,x in enumerate(list(input())):
        if x=="#":
            lst.append([i,j])

if len(lst)%2==1:
    print("NO")
else:
    for i in range(1,len(lst)//2+1):
        if f(i):
            break
    else:
        print("NO")
0