結果

問題 No.179 塗り分け
ユーザー mlihua09
提出日時 2020-08-23 14:04:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,392 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 82,944 KB
最終ジャッジ日時 2024-10-15 18:13:27
合計ジャッジ時間 17,600 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 39 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #




H, W = map(int, input().split())

S = [[1 if i == '#' else 0 for i in input()] for _ in range(H)]

from copy import deepcopy

for i in range(H):
    
    for j in range(-W + 1, W):
        
        if i == 0 and j <= 0:
            
            
            continue
        
        
        else:
            
            s = deepcopy(S)
            
            B = True
            
            for h in range(H):
                
                if B:
                    
                    
                    for w in range(W):
                    
                      if s[h][w] == 1:
                          
                          s[h][w] = 0
                          
                          if h + i < H and 0 <= w + j < W and s[h + i][w + j]:
                              
                              s[h + i][w + j] = 0
                              
                              
                          else:
                              
                              B = False
                              
                              break
                          
                          
                else:
                    
                    break
                
            if B:
                
                print('YES')
                
                exit()
                
                
                
print('NO')
0