結果

問題 No.179 塗り分け
ユーザー toyuzukotoyuzuko
提出日時 2020-02-04 23:13:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 10,388 KB
最終ジャッジ日時 2023-10-21 06:40:35
合計ジャッジ時間 12,648 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,240 KB
testcase_01 AC 25 ms
10,240 KB
testcase_02 AC 27 ms
10,240 KB
testcase_03 AC 30 ms
10,240 KB
testcase_04 AC 30 ms
10,240 KB
testcase_05 AC 78 ms
10,248 KB
testcase_06 AC 25 ms
10,244 KB
testcase_07 WA -
testcase_08 AC 413 ms
10,288 KB
testcase_09 AC 418 ms
10,288 KB
testcase_10 AC 30 ms
10,288 KB
testcase_11 AC 30 ms
10,284 KB
testcase_12 AC 505 ms
10,284 KB
testcase_13 AC 29 ms
10,244 KB
testcase_14 AC 29 ms
10,244 KB
testcase_15 AC 24 ms
10,240 KB
testcase_16 AC 24 ms
10,240 KB
testcase_17 AC 25 ms
10,240 KB
testcase_18 AC 243 ms
10,288 KB
testcase_19 AC 35 ms
10,288 KB
testcase_20 AC 414 ms
10,288 KB
testcase_21 AC 959 ms
10,288 KB
testcase_22 AC 2,204 ms
10,288 KB
testcase_23 AC 28 ms
10,288 KB
testcase_24 AC 2,212 ms
10,388 KB
testcase_25 AC 45 ms
10,388 KB
testcase_26 AC 241 ms
10,388 KB
testcase_27 AC 383 ms
10,388 KB
testcase_28 AC 218 ms
10,388 KB
testcase_29 AC 389 ms
10,388 KB
testcase_30 AC 288 ms
10,388 KB
testcase_31 AC 379 ms
10,388 KB
testcase_32 AC 268 ms
10,388 KB
testcase_33 AC 394 ms
10,388 KB
testcase_34 AC 235 ms
10,388 KB
testcase_35 AC 389 ms
10,388 KB
testcase_36 AC 28 ms
10,340 KB
testcase_37 AC 26 ms
10,340 KB
testcase_38 AC 26 ms
10,340 KB
testcase_39 AC 24 ms
10,340 KB
testcase_40 AC 26 ms
10,340 KB
testcase_41 AC 28 ms
10,340 KB
testcase_42 AC 28 ms
10,340 KB
testcase_43 AC 40 ms
10,348 KB
testcase_44 AC 76 ms
10,356 KB
testcase_45 AC 27 ms
10,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = map(int,input().split())
S = [input() for _ in range(H)]
flag = False


for dz in range(1,H*W):
    dx,dy = divmod(dz,W)
    checked = [[0 for j in range(W)] for i in range(H)]
    for sz in range(H*W):
        sx,sy = divmod(sz,W)
        if S[sx][sy] == '#' and not checked[sx][sy]:
            nx,ny = sx+dx,sy+dy
            if 0<=nx<H and 0<=ny<W and S[nx][ny] == '#':
                checked[nx][ny] = 1
            else:
                break
    else:
        flag = True
        break

for dz in range(1,H*W):
    dx,dy = divmod(dz,W)
    dx = -dx
    checked = [[0 for j in range(W)] for i in range(H)]
    for sz in range(H*W):
        sx,sy = divmod(sz,W)
        sx = H-1-sx
        if S[sx][sy] == '#' and not checked[sx][sy]:
            nx,ny = sx+dx,sy+dy
            if 0<=nx<H and 0<=ny<W and S[nx][ny] == '#':
                checked[nx][ny] = 1
            else:
                break
    else:
        flag = True
        break
        
print('YES' if flag else 'NO')
0