結果

問題 No.179 塗り分け
ユーザー NoneNone
提出日時 2021-05-01 09:29:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,156 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 78,764 KB
最終ジャッジ日時 2023-09-26 21:58:05
合計ジャッジ時間 7,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,320 KB
testcase_01 AC 74 ms
71,404 KB
testcase_02 AC 71 ms
71,244 KB
testcase_03 AC 78 ms
71,288 KB
testcase_04 AC 72 ms
71,264 KB
testcase_05 AC 112 ms
76,984 KB
testcase_06 AC 80 ms
75,696 KB
testcase_07 WA -
testcase_08 AC 155 ms
78,612 KB
testcase_09 AC 156 ms
78,292 KB
testcase_10 AC 86 ms
75,984 KB
testcase_11 AC 86 ms
76,164 KB
testcase_12 AC 146 ms
77,960 KB
testcase_13 AC 77 ms
75,236 KB
testcase_14 AC 78 ms
75,500 KB
testcase_15 AC 73 ms
71,500 KB
testcase_16 AC 72 ms
71,260 KB
testcase_17 AC 74 ms
71,344 KB
testcase_18 AC 132 ms
78,452 KB
testcase_19 AC 91 ms
76,312 KB
testcase_20 AC 149 ms
78,236 KB
testcase_21 AC 164 ms
78,424 KB
testcase_22 AC 194 ms
78,244 KB
testcase_23 AC 83 ms
76,144 KB
testcase_24 AC 192 ms
78,324 KB
testcase_25 AC 90 ms
76,504 KB
testcase_26 AC 129 ms
77,896 KB
testcase_27 AC 136 ms
78,332 KB
testcase_28 AC 130 ms
77,920 KB
testcase_29 AC 144 ms
78,436 KB
testcase_30 AC 146 ms
78,764 KB
testcase_31 AC 142 ms
78,396 KB
testcase_32 AC 138 ms
78,052 KB
testcase_33 AC 152 ms
78,600 KB
testcase_34 AC 143 ms
78,540 KB
testcase_35 AC 150 ms
78,412 KB
testcase_36 AC 73 ms
71,488 KB
testcase_37 AC 74 ms
71,416 KB
testcase_38 AC 77 ms
71,264 KB
testcase_39 AC 74 ms
71,348 KB
testcase_40 AC 75 ms
71,584 KB
testcase_41 AC 74 ms
71,416 KB
testcase_42 AC 73 ms
71,288 KB
testcase_43 AC 91 ms
76,560 KB
testcase_44 AC 99 ms
77,132 KB
testcase_45 AC 80 ms
75,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(grid):
    for h0 in range(H):
        for w0 in range(W):
            if (h0,w0)==(0,0):
                continue
            flg=0
            used=[[0]*W for _ in range(H)]
            for h in range(H):
                for w in range(W):
                    if grid[h][w]==".":
                        continue
                    if grid[h][w]=="#":
                        if used[h][w]==1:
                            continue
                        if not (h+h0<0 or w+w0<0 or h+h0>=H or w+w0>=W or grid[h+h0][w+w0]=="."):
                            used[h+h0][w+w0]=1
                            continue
                    flg=1
                    break
                if flg==1:
                    break
            if flg==0:
                return True
    return False


H,W=map(int,input().split())
grid=[[0]*W for _ in range(H)]
for h in range(H):
    for w,s in enumerate(input().rstrip()):
        grid[h][w]=s

res=0

res|=solve(grid)

for h in range(H):
    grid[h].reverse()

res|=solve(grid)

grid.reverse()

res|=solve(grid)

for h in range(H):
    grid[h].reverse()


res|=solve(grid)

print("YES" if res else "NO")
0