結果

問題 No.2641 draw X
ユーザー Ekiben542Ekiben542
提出日時 2024-02-23 16:30:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 105,260 KB
最終ジャッジ日時 2024-02-23 16:30:53
合計ジャッジ時間 5,361 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 34 ms
53,460 KB
testcase_11 AC 34 ms
53,460 KB
testcase_12 AC 34 ms
53,460 KB
testcase_13 WA -
testcase_14 AC 33 ms
53,460 KB
testcase_15 AC 99 ms
103,596 KB
testcase_16 WA -
testcase_17 AC 34 ms
53,460 KB
testcase_18 AC 34 ms
53,460 KB
testcase_19 AC 33 ms
53,460 KB
testcase_20 AC 41 ms
57,644 KB
testcase_21 AC 40 ms
61,740 KB
testcase_22 AC 39 ms
57,644 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 37 ms
55,596 KB
testcase_26 WA -
testcase_27 AC 39 ms
55,596 KB
testcase_28 AC 46 ms
71,168 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 57 ms
83,756 KB
testcase_32 WA -
testcase_33 AC 77 ms
100,908 KB
testcase_34 AC 50 ms
75,588 KB
testcase_35 AC 60 ms
83,628 KB
testcase_36 WA -
testcase_37 AC 92 ms
102,572 KB
testcase_38 AC 88 ms
102,444 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 89 ms
103,340 KB
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

def is_valid(x, y):
    if x < 0 or y < 0 or x >= H or y >= W:
        return False
    return True

def can_draw(x, y):
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]
        if is_valid(nx, ny) and S[nx][ny] == '#':
            return False
    return True

for i in range(H):
    for j in range(W):
        if S[i][j] == '#' and not can_draw(i, j):
            print('No')
            exit(0)

print('Yes')
0