結果

問題 No.179 塗り分け
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-25 20:47:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,200 ms / 3,000 ms
コード長 1,199 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 8,548 KB
最終ジャッジ日時 2023-09-30 20:56:52
合計ジャッジ時間 5,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,828 KB
testcase_01 AC 18 ms
7,872 KB
testcase_02 AC 17 ms
7,820 KB
testcase_03 AC 16 ms
7,740 KB
testcase_04 AC 17 ms
7,872 KB
testcase_05 AC 22 ms
8,228 KB
testcase_06 AC 18 ms
8,284 KB
testcase_07 AC 17 ms
8,216 KB
testcase_08 AC 17 ms
8,304 KB
testcase_09 AC 17 ms
8,364 KB
testcase_10 AC 109 ms
8,496 KB
testcase_11 AC 95 ms
8,548 KB
testcase_12 AC 2,200 ms
8,504 KB
testcase_13 AC 16 ms
7,772 KB
testcase_14 AC 16 ms
7,872 KB
testcase_15 AC 16 ms
8,256 KB
testcase_16 AC 17 ms
7,772 KB
testcase_17 AC 16 ms
8,216 KB
testcase_18 AC 41 ms
8,272 KB
testcase_19 AC 39 ms
8,208 KB
testcase_20 AC 277 ms
8,352 KB
testcase_21 AC 18 ms
8,208 KB
testcase_22 AC 20 ms
8,316 KB
testcase_23 AC 25 ms
8,268 KB
testcase_24 AC 18 ms
8,380 KB
testcase_25 AC 18 ms
8,248 KB
testcase_26 AC 20 ms
8,380 KB
testcase_27 AC 20 ms
8,240 KB
testcase_28 AC 35 ms
8,352 KB
testcase_29 AC 22 ms
8,352 KB
testcase_30 AC 44 ms
8,292 KB
testcase_31 AC 27 ms
8,292 KB
testcase_32 AC 50 ms
8,292 KB
testcase_33 AC 36 ms
8,236 KB
testcase_34 AC 58 ms
8,236 KB
testcase_35 AC 34 ms
8,240 KB
testcase_36 AC 17 ms
7,880 KB
testcase_37 AC 16 ms
7,900 KB
testcase_38 AC 16 ms
7,820 KB
testcase_39 AC 17 ms
7,708 KB
testcase_40 AC 17 ms
7,772 KB
testcase_41 AC 16 ms
7,800 KB
testcase_42 AC 16 ms
7,708 KB
testcase_43 AC 17 ms
8,220 KB
testcase_44 AC 17 ms
8,356 KB
testcase_45 AC 16 ms
7,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = [int(i) for i in input().split()]

mass = []
for i in range(H):
    mass.append(input())

black = [[False for i in range(W)] for j in range(H)]
black_count = 0
black_mass = []
for i in range(H):
    for j in range(W):
        if mass[i][j]=="#":
            black[i][j]=True
            black_mass.append([i,j])
            black_count+=1
        else:
            black[i][j]=False

ans=False
if len(black_mass)!=0:
    ref_point=black_mass[0]
for move_point in black_mass:
    if move_point == ref_point:
        continue
    paired_mass=[]
    paired_mass.append(ref_point)
    paired_mass.append(move_point)
    diff=[move_point[0]-ref_point[0],move_point[1]-ref_point[1]]
    for test_point in black_mass:
        if(test_point in paired_mass):
            continue
        tmp_add=[test_point[0]+diff[0],test_point[1]+diff[1]]
        if(test_point[0]+diff[0]>=H or test_point[1]+diff[1]>=W):
            break
        elif(black[test_point[0]+diff[0]][test_point[1]+diff[1]]==False):
            break
        paired_mass.append(test_point)
        paired_mass.append(tmp_add)
    if len(paired_mass)==len(black_mass):
        ans=True
        break

print("YES" if ans==True else "NO")
0