結果

問題 No.179 塗り分け
ユーザー AEnAEn
提出日時 2022-05-13 13:57:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 78,128 KB
最終ジャッジ日時 2023-09-28 17:13:55
合計ジャッジ時間 7,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,164 KB
testcase_01 AC 77 ms
71,356 KB
testcase_02 AC 76 ms
70,976 KB
testcase_03 WA -
testcase_04 AC 76 ms
71,436 KB
testcase_05 AC 77 ms
71,272 KB
testcase_06 AC 83 ms
75,744 KB
testcase_07 AC 79 ms
71,356 KB
testcase_08 WA -
testcase_09 AC 86 ms
75,952 KB
testcase_10 AC 140 ms
77,676 KB
testcase_11 AC 136 ms
77,428 KB
testcase_12 WA -
testcase_13 AC 86 ms
75,828 KB
testcase_14 AC 82 ms
71,280 KB
testcase_15 AC 76 ms
71,304 KB
testcase_16 AC 77 ms
71,176 KB
testcase_17 AC 75 ms
71,180 KB
testcase_18 AC 77 ms
71,444 KB
testcase_19 AC 84 ms
75,948 KB
testcase_20 AC 75 ms
71,452 KB
testcase_21 AC 77 ms
71,180 KB
testcase_22 WA -
testcase_23 AC 78 ms
71,256 KB
testcase_24 WA -
testcase_25 AC 76 ms
71,368 KB
testcase_26 AC 132 ms
77,912 KB
testcase_27 WA -
testcase_28 AC 133 ms
77,784 KB
testcase_29 WA -
testcase_30 AC 124 ms
78,068 KB
testcase_31 WA -
testcase_32 AC 118 ms
77,812 KB
testcase_33 WA -
testcase_34 AC 130 ms
77,868 KB
testcase_35 WA -
testcase_36 AC 77 ms
71,056 KB
testcase_37 AC 77 ms
71,460 KB
testcase_38 WA -
testcase_39 AC 79 ms
71,180 KB
testcase_40 AC 81 ms
71,248 KB
testcase_41 AC 78 ms
71,100 KB
testcase_42 AC 79 ms
71,572 KB
testcase_43 AC 101 ms
76,656 KB
testcase_44 AC 138 ms
77,500 KB
testcase_45 AC 87 ms
76,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
c = []
cnt = 0
for _ in range(H):
    s = list(input())
    cnt += s.count('#')
    c.append(s)
if cnt == 0 or cnt%2==1:
    print('NO')
    exit()

def solve(i, j):
    r1, r2 = range(H), range(W)
    r11, r22 = reversed(range(H)), reversed(range(W))
    w1 = [r1, r11]
    w2 = [r2, r22]
    p, q = w1[i<0], w2[j<0]
    b = set()
    for x in p:
        for y in q:
            if x+i<0 or x+i>H-1 or y+j<0 or y+j>W-1:
                if (x, y) not in b and c[x][y]=='#':
                    return False
                else:
                    continue
            if (x, y) in b or c[x][y] == '.':
                continue
            b.add((x, y))
            if c[x+i][y+j]=='.':
                return False
            else:
                b.add((x+i, y+j))
    return True

for i in range(-H+1, H):
    for j in range(-W+1, W):
        if i == j:
            continue
        if solve(i, j):
            print('YES')
            exit()
print('NO')
0