結果

問題 No.179 塗り分け
ユーザー lloyzlloyz
提出日時 2023-05-25 00:06:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,325 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 78,056 KB
最終ジャッジ日時 2023-08-25 14:59:10
合計ジャッジ時間 7,356 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 WA -
testcase_02 AC 72 ms
71,376 KB
testcase_03 AC 71 ms
71,256 KB
testcase_04 AC 71 ms
71,424 KB
testcase_05 WA -
testcase_06 AC 75 ms
75,196 KB
testcase_07 WA -
testcase_08 AC 177 ms
77,784 KB
testcase_09 AC 177 ms
77,620 KB
testcase_10 AC 87 ms
76,648 KB
testcase_11 AC 86 ms
76,792 KB
testcase_12 AC 180 ms
78,056 KB
testcase_13 AC 75 ms
75,004 KB
testcase_14 AC 75 ms
76,064 KB
testcase_15 WA -
testcase_16 AC 71 ms
71,272 KB
testcase_17 WA -
testcase_18 AC 97 ms
77,352 KB
testcase_19 AC 97 ms
77,388 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 219 ms
77,932 KB
testcase_23 AC 90 ms
76,708 KB
testcase_24 AC 181 ms
77,744 KB
testcase_25 AC 83 ms
76,484 KB
testcase_26 AC 110 ms
77,088 KB
testcase_27 AC 179 ms
77,996 KB
testcase_28 AC 101 ms
77,380 KB
testcase_29 AC 187 ms
77,868 KB
testcase_30 AC 140 ms
77,488 KB
testcase_31 AC 174 ms
77,580 KB
testcase_32 AC 130 ms
77,364 KB
testcase_33 AC 188 ms
77,740 KB
testcase_34 AC 116 ms
77,376 KB
testcase_35 AC 192 ms
78,052 KB
testcase_36 AC 71 ms
71,100 KB
testcase_37 WA -
testcase_38 AC 72 ms
71,372 KB
testcase_39 AC 72 ms
71,176 KB
testcase_40 AC 75 ms
75,328 KB
testcase_41 WA -
testcase_42 AC 76 ms
75,124 KB
testcase_43 AC 86 ms
76,716 KB
testcase_44 AC 108 ms
77,140 KB
testcase_45 AC 79 ms
76,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

c = 0
for i in range(h):
    for j in range(w):
        if F[i][j] == '#':
            c += 1
if c == 0 or c % 2 == 1:
    print("No")
    exit()

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