結果

問題 No.179 塗り分け
ユーザー convexineqconvexineq
提出日時 2020-12-13 13:57:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 3,000 ms
コード長 843 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 81,584 KB
実行使用メモリ 76,336 KB
最終ジャッジ日時 2023-10-20 03:41:31
合計ジャッジ時間 4,402 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,400 KB
testcase_01 AC 34 ms
53,400 KB
testcase_02 AC 35 ms
53,400 KB
testcase_03 AC 41 ms
53,400 KB
testcase_04 AC 35 ms
53,400 KB
testcase_05 AC 56 ms
75,212 KB
testcase_06 AC 34 ms
53,400 KB
testcase_07 AC 43 ms
59,508 KB
testcase_08 AC 64 ms
75,648 KB
testcase_09 AC 83 ms
76,004 KB
testcase_10 AC 44 ms
61,840 KB
testcase_11 AC 44 ms
61,840 KB
testcase_12 AC 93 ms
76,092 KB
testcase_13 AC 37 ms
53,400 KB
testcase_14 AC 38 ms
59,152 KB
testcase_15 AC 35 ms
53,400 KB
testcase_16 AC 35 ms
53,400 KB
testcase_17 AC 35 ms
53,400 KB
testcase_18 AC 46 ms
64,008 KB
testcase_19 AC 46 ms
64,008 KB
testcase_20 AC 92 ms
76,104 KB
testcase_21 AC 93 ms
76,256 KB
testcase_22 AC 152 ms
76,128 KB
testcase_23 AC 43 ms
61,820 KB
testcase_24 AC 85 ms
76,032 KB
testcase_25 AC 43 ms
61,880 KB
testcase_26 AC 71 ms
75,924 KB
testcase_27 AC 95 ms
76,032 KB
testcase_28 AC 70 ms
75,928 KB
testcase_29 AC 94 ms
76,336 KB
testcase_30 AC 79 ms
75,984 KB
testcase_31 AC 91 ms
76,112 KB
testcase_32 AC 59 ms
75,300 KB
testcase_33 AC 96 ms
76,308 KB
testcase_34 AC 74 ms
75,952 KB
testcase_35 AC 91 ms
76,128 KB
testcase_36 AC 36 ms
53,400 KB
testcase_37 AC 35 ms
53,400 KB
testcase_38 AC 35 ms
53,400 KB
testcase_39 AC 35 ms
53,400 KB
testcase_40 AC 35 ms
53,400 KB
testcase_41 AC 35 ms
53,400 KB
testcase_42 AC 35 ms
53,400 KB
testcase_43 AC 45 ms
63,612 KB
testcase_44 AC 57 ms
75,044 KB
testcase_45 AC 45 ms
59,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(a,b):
    valid = [vi[:] for vi in V]
    for i in range(h):
        for j in range(w):
            if valid[i][j]:
                if i+a >= h or j+b >= w or valid[i+a][j+b]==0:
                    return 0
                else:
                    valid[i+a][j+b] = 0
    return 1
    
h,w = map(int,input().split())
b = [input() for _ in range(h)]
V = [[1 if b[i][j]== "#" else 0 for j in range(w)] for i in range(h)]

ok = 0
for i in range(h):
    for j in range(w):
        if i==j==0: continue
        if check(i,j):
            ok = 1
            break
    if ok: break

for i in range(h): V[i] = V[i][::-1]
for i in range(h):
    for j in range(w):
        if i==j==0: continue
        if check(i,j):
            ok = 1
            break
    if ok: break

any1 = max(max(vi) for vi in V)
print("YES" if ok and any1 else "NO")
0