結果

問題 No.179 塗り分け
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-10 22:09:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,645 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 72,960 KB
最終ジャッジ日時 2024-05-05 07:33:22
合計ジャッジ時間 3,453 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 35 ms
52,096 KB
testcase_02 AC 34 ms
52,352 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 WA -
testcase_05 AC 38 ms
53,376 KB
testcase_06 AC 35 ms
52,096 KB
testcase_07 WA -
testcase_08 AC 49 ms
64,000 KB
testcase_09 WA -
testcase_10 AC 41 ms
59,392 KB
testcase_11 AC 43 ms
59,648 KB
testcase_12 AC 70 ms
72,960 KB
testcase_13 AC 35 ms
52,480 KB
testcase_14 AC 40 ms
58,112 KB
testcase_15 AC 35 ms
52,352 KB
testcase_16 AC 34 ms
52,096 KB
testcase_17 AC 35 ms
51,840 KB
testcase_18 AC 59 ms
68,352 KB
testcase_19 AC 57 ms
67,456 KB
testcase_20 AC 62 ms
70,016 KB
testcase_21 AC 55 ms
67,456 KB
testcase_22 AC 62 ms
70,144 KB
testcase_23 AC 46 ms
59,392 KB
testcase_24 AC 55 ms
66,304 KB
testcase_25 AC 42 ms
59,520 KB
testcase_26 WA -
testcase_27 AC 45 ms
63,360 KB
testcase_28 WA -
testcase_29 AC 46 ms
63,104 KB
testcase_30 WA -
testcase_31 AC 45 ms
63,360 KB
testcase_32 WA -
testcase_33 AC 45 ms
63,104 KB
testcase_34 WA -
testcase_35 AC 47 ms
63,616 KB
testcase_36 AC 35 ms
52,224 KB
testcase_37 AC 35 ms
52,224 KB
testcase_38 AC 35 ms
52,352 KB
testcase_39 AC 34 ms
52,096 KB
testcase_40 AC 36 ms
52,096 KB
testcase_41 AC 37 ms
51,840 KB
testcase_42 AC 37 ms
52,352 KB
testcase_43 AC 37 ms
52,736 KB
testcase_44 AC 38 ms
53,504 KB
testcase_45 AC 35 ms
52,480 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