結果

問題 No.179 塗り分け
ユーザー lloyzlloyz
提出日時 2023-05-25 00:03:34
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 1,178 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 78,108 KB
最終ジャッジ日時 2023-08-25 14:57:55
合計ジャッジ時間 7,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,368 KB
testcase_01 AC 59 ms
71,368 KB
testcase_02 AC 59 ms
71,260 KB
testcase_03 AC 58 ms
71,504 KB
testcase_04 AC 58 ms
71,460 KB
testcase_05 AC 90 ms
77,280 KB
testcase_06 AC 61 ms
75,104 KB
testcase_07 WA -
testcase_08 AC 139 ms
77,604 KB
testcase_09 AC 134 ms
77,684 KB
testcase_10 AC 70 ms
76,664 KB
testcase_11 AC 73 ms
76,676 KB
testcase_12 AC 159 ms
77,700 KB
testcase_13 AC 63 ms
75,096 KB
testcase_14 AC 68 ms
75,948 KB
testcase_15 AC 62 ms
71,260 KB
testcase_16 AC 58 ms
71,172 KB
testcase_17 AC 63 ms
70,992 KB
testcase_18 AC 84 ms
77,212 KB
testcase_19 AC 83 ms
77,324 KB
testcase_20 AC 159 ms
77,896 KB
testcase_21 AC 152 ms
77,976 KB
testcase_22 AC 173 ms
77,560 KB
testcase_23 AC 74 ms
76,372 KB
testcase_24 AC 148 ms
77,628 KB
testcase_25 AC 73 ms
76,364 KB
testcase_26 AC 96 ms
77,276 KB
testcase_27 AC 155 ms
77,924 KB
testcase_28 AC 86 ms
77,328 KB
testcase_29 AC 171 ms
78,028 KB
testcase_30 AC 113 ms
77,508 KB
testcase_31 AC 149 ms
78,092 KB
testcase_32 AC 104 ms
77,520 KB
testcase_33 AC 162 ms
78,108 KB
testcase_34 AC 104 ms
77,732 KB
testcase_35 AC 169 ms
78,000 KB
testcase_36 AC 64 ms
71,288 KB
testcase_37 AC 62 ms
71,376 KB
testcase_38 AC 63 ms
71,100 KB
testcase_39 AC 62 ms
71,476 KB
testcase_40 AC 64 ms
75,072 KB
testcase_41 AC 62 ms
71,216 KB
testcase_42 AC 65 ms
74,888 KB
testcase_43 AC 77 ms
76,876 KB
testcase_44 AC 93 ms
77,216 KB
testcase_45 AC 67 ms
76,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
F = [list(input()) for _ in range(h)]

for di in range(h):
    for dj in range(-w + 1, w):
        if di == 0 and dj == 0:
            continue
        C = [[None for _ in range(w)] for _ in range(h)]
        flag = True
        for i in range(h):
            for j in range(w):
                if F[i][j] == '#' and C[i][j] == None:
                    C[i][j] = 'R'
                    if 0 <= i + di < h and 0 <= j + dj < w:
                        if F[i + di][j + dj] == '#' and C[i + di][j + dj] == None:
                            C[i + di][j + dj] = 'B'
                        else:
                            flag = False
                            break
                    else:
                        flag = False
                        break
            if not flag:
                break
        if flag:
            for i in range(h):
                for j in range(w):
                    if F[i][j] == '#' and C[i][j] == None:
                        flag = False
                        break
                if not flag:
                    break
        if flag:
            print("YES")
            exit()
print("NO")
0