結果

問題 No.179 塗り分け
ユーザー mlihua09mlihua09
提出日時 2020-08-23 14:14:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,275 ms / 3,000 ms
コード長 1,462 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 85,204 KB
最終ジャッジ日時 2023-09-30 21:31:32
合計ジャッジ時間 21,928 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,256 KB
testcase_01 AC 95 ms
71,652 KB
testcase_02 AC 95 ms
71,508 KB
testcase_03 AC 94 ms
71,596 KB
testcase_04 AC 95 ms
71,612 KB
testcase_05 AC 265 ms
78,456 KB
testcase_06 AC 95 ms
71,452 KB
testcase_07 AC 101 ms
75,644 KB
testcase_08 AC 1,046 ms
82,992 KB
testcase_09 AC 1,004 ms
82,248 KB
testcase_10 AC 107 ms
76,504 KB
testcase_11 AC 106 ms
76,548 KB
testcase_12 AC 1,129 ms
85,156 KB
testcase_13 AC 111 ms
77,460 KB
testcase_14 AC 111 ms
77,212 KB
testcase_15 AC 93 ms
71,504 KB
testcase_16 AC 94 ms
71,740 KB
testcase_17 AC 92 ms
71,724 KB
testcase_18 AC 144 ms
77,812 KB
testcase_19 AC 142 ms
78,064 KB
testcase_20 AC 1,130 ms
85,204 KB
testcase_21 AC 1,110 ms
83,844 KB
testcase_22 AC 1,119 ms
84,148 KB
testcase_23 AC 106 ms
76,560 KB
testcase_24 AC 1,094 ms
84,628 KB
testcase_25 AC 117 ms
77,612 KB
testcase_26 AC 286 ms
79,848 KB
testcase_27 AC 1,161 ms
83,252 KB
testcase_28 AC 165 ms
77,840 KB
testcase_29 AC 1,268 ms
84,860 KB
testcase_30 AC 609 ms
81,384 KB
testcase_31 AC 1,275 ms
84,216 KB
testcase_32 AC 445 ms
80,252 KB
testcase_33 AC 1,250 ms
84,300 KB
testcase_34 AC 342 ms
79,352 KB
testcase_35 AC 1,247 ms
84,580 KB
testcase_36 AC 94 ms
71,612 KB
testcase_37 AC 93 ms
71,516 KB
testcase_38 AC 93 ms
71,520 KB
testcase_39 AC 94 ms
71,776 KB
testcase_40 AC 101 ms
76,288 KB
testcase_41 AC 93 ms
71,504 KB
testcase_42 AC 94 ms
71,688 KB
testcase_43 AC 140 ms
78,040 KB
testcase_44 AC 274 ms
79,000 KB
testcase_45 AC 119 ms
77,872 KB
権限があれば一括ダウンロードができます

ソースコード

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

if sum([sum(s) for s in S]) < 2:
    
    print('NO')
    
    exit()

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