結果

問題 No.179 塗り分け
ユーザー 👑 rin204rin204
提出日時 2022-01-20 09:08:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 3,000 ms
コード長 688 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 77,352 KB
最終ジャッジ日時 2023-08-15 08:32:54
合計ジャッジ時間 5,849 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,176 KB
testcase_01 AC 73 ms
71,452 KB
testcase_02 AC 74 ms
71,412 KB
testcase_03 AC 73 ms
70,952 KB
testcase_04 AC 74 ms
71,148 KB
testcase_05 AC 73 ms
71,264 KB
testcase_06 AC 72 ms
71,104 KB
testcase_07 AC 76 ms
75,640 KB
testcase_08 AC 76 ms
75,700 KB
testcase_09 AC 76 ms
75,840 KB
testcase_10 AC 81 ms
76,272 KB
testcase_11 AC 82 ms
76,276 KB
testcase_12 AC 127 ms
77,336 KB
testcase_13 AC 73 ms
71,148 KB
testcase_14 AC 74 ms
71,088 KB
testcase_15 AC 72 ms
71,432 KB
testcase_16 AC 73 ms
71,332 KB
testcase_17 AC 74 ms
71,404 KB
testcase_18 AC 81 ms
76,456 KB
testcase_19 AC 81 ms
76,136 KB
testcase_20 AC 78 ms
76,192 KB
testcase_21 AC 77 ms
75,872 KB
testcase_22 AC 83 ms
76,164 KB
testcase_23 AC 80 ms
76,236 KB
testcase_24 AC 76 ms
75,704 KB
testcase_25 AC 76 ms
75,564 KB
testcase_26 AC 78 ms
75,968 KB
testcase_27 AC 87 ms
76,336 KB
testcase_28 AC 82 ms
76,292 KB
testcase_29 AC 94 ms
77,244 KB
testcase_30 AC 89 ms
76,400 KB
testcase_31 AC 101 ms
77,256 KB
testcase_32 AC 88 ms
76,368 KB
testcase_33 AC 98 ms
77,216 KB
testcase_34 AC 85 ms
76,240 KB
testcase_35 AC 103 ms
77,352 KB
testcase_36 AC 73 ms
71,452 KB
testcase_37 AC 71 ms
71,396 KB
testcase_38 AC 73 ms
71,188 KB
testcase_39 AC 74 ms
70,936 KB
testcase_40 AC 73 ms
71,144 KB
testcase_41 AC 75 ms
71,212 KB
testcase_42 AC 73 ms
71,412 KB
testcase_43 AC 73 ms
71,132 KB
testcase_44 AC 74 ms
71,128 KB
testcase_45 AC 72 ms
71,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
S = [input() for _ in range(h)]

X = []
Y = []
dic = {}
for i in range(h):
    for j in range(w):
        if S[i][j] == "#":
            dic[i * 100 + j] = len(X)
            X.append(i)
            Y.append(j)
            
l = len(X)
if l % 2 == 1:
    print("NO")
    exit()
    
i = 0
for j in range(i + 1, l):
    di = X[j] - X[i]
    dj = Y[j] - Y[i]
    used = [False] * l
    for k in range(l):
        if used[k]:
            continue
        ni = X[k] + di
        nj = Y[k] + dj
        if ni * 100 + nj not in dic:
            break
        x = dic[ni * 100 + nj]
        used[x] = True
    else:
        print("YES")
        exit()
print("NO")
0