結果

問題 No.179 塗り分け
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-25 20:25:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,066 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 16,316 KB
最終ジャッジ日時 2023-08-18 06:37:32
合計ジャッジ時間 5,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
16,316 KB
testcase_01 AC 16 ms
7,844 KB
testcase_02 AC 16 ms
7,840 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 15 ms
7,868 KB
testcase_05 AC 35 ms
8,252 KB
testcase_06 AC 33 ms
8,292 KB
testcase_07 RE -
testcase_08 AC 17 ms
7,760 KB
testcase_09 AC 16 ms
7,796 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
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
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

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