結果

問題 No.179 塗り分け
ユーザー todo_2marikotodo_2mariko
提出日時 2019-03-13 00:01:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 648 ms / 3,000 ms
コード長 820 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 8,408 KB
最終ジャッジ日時 2023-09-30 21:07:37
合計ジャッジ時間 3,892 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,856 KB
testcase_01 AC 15 ms
8,156 KB
testcase_02 AC 14 ms
7,972 KB
testcase_03 AC 15 ms
7,972 KB
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 15 ms
8,204 KB
testcase_06 AC 15 ms
7,908 KB
testcase_07 AC 15 ms
8,276 KB
testcase_08 AC 74 ms
8,312 KB
testcase_09 AC 100 ms
8,400 KB
testcase_10 AC 17 ms
8,220 KB
testcase_11 AC 16 ms
8,220 KB
testcase_12 AC 160 ms
8,268 KB
testcase_13 AC 16 ms
7,796 KB
testcase_14 AC 16 ms
7,936 KB
testcase_15 AC 15 ms
8,248 KB
testcase_16 AC 14 ms
7,876 KB
testcase_17 AC 14 ms
8,160 KB
testcase_18 AC 17 ms
8,348 KB
testcase_19 AC 17 ms
8,408 KB
testcase_20 AC 15 ms
8,176 KB
testcase_21 AC 15 ms
8,324 KB
testcase_22 AC 648 ms
8,344 KB
testcase_23 AC 17 ms
8,404 KB
testcase_24 AC 102 ms
8,220 KB
testcase_25 AC 17 ms
8,400 KB
testcase_26 AC 25 ms
8,272 KB
testcase_27 AC 63 ms
8,356 KB
testcase_28 AC 19 ms
8,404 KB
testcase_29 AC 58 ms
8,264 KB
testcase_30 AC 38 ms
8,308 KB
testcase_31 AC 67 ms
8,348 KB
testcase_32 AC 30 ms
8,220 KB
testcase_33 AC 65 ms
8,316 KB
testcase_34 AC 25 ms
8,308 KB
testcase_35 AC 67 ms
8,220 KB
testcase_36 AC 15 ms
7,844 KB
testcase_37 AC 15 ms
8,208 KB
testcase_38 AC 15 ms
7,840 KB
testcase_39 AC 15 ms
7,928 KB
testcase_40 AC 15 ms
7,932 KB
testcase_41 AC 16 ms
8,160 KB
testcase_42 AC 15 ms
7,784 KB
testcase_43 AC 17 ms
7,832 KB
testcase_44 AC 21 ms
7,940 KB
testcase_45 AC 15 ms
7,820 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'

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