結果

問題 No.179 塗り分け
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-25 20:28:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,107 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,032 KB
実行使用メモリ 13,132 KB
最終ジャッジ日時 2023-08-18 06:37:43
合計ジャッジ時間 5,460 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,628 KB
testcase_01 AC 16 ms
8,264 KB
testcase_02 AC 16 ms
8,224 KB
testcase_03 AC 16 ms
8,224 KB
testcase_04 AC 16 ms
8,196 KB
testcase_05 AC 36 ms
8,300 KB
testcase_06 AC 19 ms
8,232 KB
testcase_07 AC 16 ms
8,220 KB
testcase_08 AC 17 ms
8,180 KB
testcase_09 AC 17 ms
7,784 KB
testcase_10 AC 200 ms
8,656 KB
testcase_11 AC 170 ms
8,612 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

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(not(tmp_add in black_mass) or tmp_add in paired_mass):
            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