結果

問題 No.179 塗り分け
ユーザー todo_2marikotodo_2mariko
提出日時 2019-03-12 22:36:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-09-05 20:29:31
合計ジャッジ時間 37,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 15 ms
8,144 KB
testcase_02 WA -
testcase_03 AC 16 ms
7,976 KB
testcase_04 AC 17 ms
7,852 KB
testcase_05 AC 16 ms
8,188 KB
testcase_06 WA -
testcase_07 AC 15 ms
8,176 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 187 ms
8,160 KB
testcase_13 AC 18 ms
7,760 KB
testcase_14 AC 16 ms
7,712 KB
testcase_15 AC 16 ms
8,292 KB
testcase_16 WA -
testcase_17 AC 16 ms
8,168 KB
testcase_18 AC 214 ms
8,240 KB
testcase_19 AC 200 ms
8,228 KB
testcase_20 AC 16 ms
8,264 KB
testcase_21 AC 16 ms
8,252 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,932 ms
8,412 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2,621 ms
8,252 KB
testcase_28 WA -
testcase_29 AC 1,933 ms
8,212 KB
testcase_30 WA -
testcase_31 AC 2,004 ms
8,288 KB
testcase_32 AC 2,818 ms
8,164 KB
testcase_33 AC 2,102 ms
8,328 KB
testcase_34 WA -
testcase_35 AC 1,082 ms
8,280 KB
testcase_36 AC 15 ms
7,848 KB
testcase_37 AC 15 ms
8,144 KB
testcase_38 AC 16 ms
7,936 KB
testcase_39 AC 16 ms
7,804 KB
testcase_40 AC 16 ms
7,804 KB
testcase_41 AC 16 ms
8,312 KB
testcase_42 AC 16 ms
7,856 KB
testcase_43 AC 47 ms
7,804 KB
testcase_44 AC 139 ms
7,856 KB
testcase_45 AC 18 ms
7,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split(' '))
sq = [input().strip() for i in range(a)]
sq2 = [c for k in sq for c in k]
ans = 'NO'

m_l = 0
m_r = 0
for c in sq:
    if '#' in c:
        m_l = max(c.index('#'), m_l)
        m_r = max(c[::-1].index('#'), m_r)

if ('#' not in sq2) or sq2.count('#') % 2 == 1:
    print('NO')
    exit()
 
for h in range(a):
    for w in range(-m_l, m_r+1):
        sq3 = list('0'*len(sq2)) 
        for t in range(len(sq2)):
            if sq[t//b][t%b]=='#' and 0 < t%b+w < b and 0 < t//b+h < a:
                if sq[t//b+h][t%b+w] == '#' and sq3[t]=='0':
                    sq3[t] = '1'
                    sq3[t+w+(b*h)] = '1'

        if sq2.count('#') == sq3.count('1'):
            ans = 'YES'
            break

print(ans)
0