結果

問題 No.179 塗り分け
ユーザー caleicalei
提出日時 2020-01-01 19:25:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,302 ms / 3,000 ms
コード長 693 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 83,732 KB
最終ジャッジ日時 2023-09-30 21:24:06
合計ジャッジ時間 26,665 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,668 KB
testcase_01 AC 94 ms
76,148 KB
testcase_02 AC 104 ms
77,556 KB
testcase_03 AC 94 ms
76,336 KB
testcase_04 AC 108 ms
77,708 KB
testcase_05 AC 237 ms
80,228 KB
testcase_06 AC 161 ms
78,932 KB
testcase_07 AC 1,302 ms
82,300 KB
testcase_08 AC 1,254 ms
82,152 KB
testcase_09 AC 129 ms
78,384 KB
testcase_10 AC 611 ms
80,756 KB
testcase_11 AC 548 ms
80,656 KB
testcase_12 AC 980 ms
82,032 KB
testcase_13 AC 119 ms
78,076 KB
testcase_14 AC 113 ms
77,408 KB
testcase_15 AC 87 ms
71,612 KB
testcase_16 AC 88 ms
71,516 KB
testcase_17 AC 86 ms
71,744 KB
testcase_18 AC 650 ms
80,776 KB
testcase_19 AC 585 ms
80,236 KB
testcase_20 AC 1,061 ms
82,504 KB
testcase_21 AC 1,134 ms
82,896 KB
testcase_22 AC 1,243 ms
82,820 KB
testcase_23 AC 630 ms
80,460 KB
testcase_24 AC 1,090 ms
81,824 KB
testcase_25 AC 833 ms
82,404 KB
testcase_26 AC 443 ms
80,008 KB
testcase_27 AC 1,130 ms
83,732 KB
testcase_28 AC 441 ms
79,692 KB
testcase_29 AC 1,205 ms
82,464 KB
testcase_30 AC 533 ms
80,928 KB
testcase_31 AC 1,188 ms
81,588 KB
testcase_32 AC 867 ms
81,592 KB
testcase_33 AC 1,145 ms
82,444 KB
testcase_34 AC 619 ms
81,636 KB
testcase_35 AC 1,166 ms
82,512 KB
testcase_36 AC 88 ms
71,600 KB
testcase_37 AC 92 ms
76,076 KB
testcase_38 AC 91 ms
76,248 KB
testcase_39 AC 94 ms
76,372 KB
testcase_40 AC 102 ms
77,976 KB
testcase_41 AC 92 ms
76,412 KB
testcase_42 AC 98 ms
76,532 KB
testcase_43 AC 160 ms
78,328 KB
testcase_44 AC 262 ms
79,228 KB
testcase_45 AC 125 ms
78,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 2020/01/01
# 解答かんにんぐ

from copy import deepcopy

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


def check(x,y):
    g=deepcopy(s)
    flag=False
    for i in range(h):
        for j in range(w):
            if g[i][j] in ['.','R','B']:continue
            if i+y<0 or i+y>=h or j+x<0 or j+x>=w:return False
            if g[i][j]==g[i+y][j+x]=='#':
                flag=True
                g[i][j]='R'
                g[i+y][j+x]='B'
            else:return False
    return flag


for x in range(-w,w+1):
    for y in range(-h,h+1):
        if x==y==0:continue
        res=check(x,y)
        if res:
            print('YES')
            exit()
print('NO')
0