結果

問題 No.179 塗り分け
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-10 22:09:33
言語 PyPy3
(7.3.11)
結果
WA  
実行時間 -
コード長 1,645 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 77,724 KB
最終ジャッジ日時 2023-08-18 00:43:03
合計ジャッジ時間 5,670 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,272 KB
testcase_01 AC 71 ms
71,460 KB
testcase_02 AC 73 ms
71,404 KB
testcase_03 AC 74 ms
71,432 KB
testcase_04 WA -
testcase_05 AC 76 ms
71,268 KB
testcase_06 AC 73 ms
71,236 KB
testcase_07 WA -
testcase_08 AC 82 ms
76,288 KB
testcase_09 WA -
testcase_10 AC 80 ms
76,104 KB
testcase_11 AC 78 ms
75,924 KB
testcase_12 AC 102 ms
77,724 KB
testcase_13 AC 73 ms
71,260 KB
testcase_14 AC 76 ms
75,488 KB
testcase_15 AC 73 ms
71,248 KB
testcase_16 AC 73 ms
71,340 KB
testcase_17 AC 71 ms
71,348 KB
testcase_18 AC 93 ms
76,692 KB
testcase_19 AC 90 ms
76,548 KB
testcase_20 AC 94 ms
77,272 KB
testcase_21 AC 91 ms
76,772 KB
testcase_22 AC 93 ms
76,840 KB
testcase_23 AC 78 ms
75,948 KB
testcase_24 AC 84 ms
76,464 KB
testcase_25 AC 78 ms
75,996 KB
testcase_26 WA -
testcase_27 AC 80 ms
75,728 KB
testcase_28 WA -
testcase_29 AC 82 ms
75,888 KB
testcase_30 WA -
testcase_31 AC 81 ms
75,768 KB
testcase_32 WA -
testcase_33 AC 79 ms
75,860 KB
testcase_34 WA -
testcase_35 AC 81 ms
76,024 KB
testcase_36 AC 73 ms
71,632 KB
testcase_37 AC 72 ms
71,340 KB
testcase_38 AC 72 ms
71,252 KB
testcase_39 AC 72 ms
71,088 KB
testcase_40 AC 71 ms
71,252 KB
testcase_41 AC 72 ms
71,316 KB
testcase_42 AC 72 ms
71,264 KB
testcase_43 AC 73 ms
71,236 KB
testcase_44 AC 73 ms
71,192 KB
testcase_45 AC 72 ms
71,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w=map(int,input().split())
g=[input() for i in range(h)]


for zure in range(1,w):
    f=[[0]*w for i in range(h)]
    ff=0
    for i in range(h):
        for j in range(w):
            if g[i][j] == '#' and f[i][j] == 0:
                if j+zure >= w:
                    ff = 1
                    break
                if g[i][j+zure] != '#':
                    ff = 1
                    break
                f[i][j+zure] = 1
                f[i][j] = 1
        if ff == 1:
            break

    if ff == 0:
        print('YES')
        exit()

for zure in range(1,h):
    f=[[0]*w for i in range(h)]
    ff=0
    for i in range(h):
        for j in range(w):
            if g[i][j] == '#' and f[i][j] == 0:

                if i+zure >= h:
                    ff = 1
                    break
                if g[i+zure][j] != '#':
                    ff= 1
                    break
                f[i+zure][j] = 1
                f[i][j] =  1
        if ff == 1:
            break

    if ff == 0:
        print('YES')
        exit()


for zure in range(1,min(h,w)):
    f=[[0]*w for i in range(h)]
    ff=0
    for i in range(h):
        for j in range(w):
            if g[i][j] == '#' and f[i][j] == 0:                        
                if i+zure >= h or j + zure >=w:
                    ff = 1
                    break
                if g[i+zure][j+zure] != '#':
                    ff = 1
                    break
                f[i+zure][j+zure] = 1
                f[i][j] = 1
        if ff == 1:
            break

    if ff == 0:
        print('YES')
        exit()

print('NO')
        
            
    
    
0