結果

問題 No.179 塗り分け
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-10 22:43:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,641 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 83,268 KB
最終ジャッジ日時 2023-08-18 01:01:23
合計ジャッジ時間 7,284 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,956 KB
testcase_01 AC 73 ms
70,680 KB
testcase_02 AC 73 ms
71,124 KB
testcase_03 AC 73 ms
71,188 KB
testcase_04 AC 74 ms
70,920 KB
testcase_05 AC 125 ms
76,992 KB
testcase_06 AC 74 ms
70,720 KB
testcase_07 AC 77 ms
75,448 KB
testcase_08 AC 100 ms
76,812 KB
testcase_09 AC 119 ms
77,048 KB
testcase_10 AC 82 ms
75,728 KB
testcase_11 AC 81 ms
75,448 KB
testcase_12 AC 136 ms
77,188 KB
testcase_13 AC 75 ms
71,168 KB
testcase_14 AC 78 ms
75,568 KB
testcase_15 AC 72 ms
71,168 KB
testcase_16 AC 73 ms
71,204 KB
testcase_17 AC 73 ms
71,148 KB
testcase_18 AC 85 ms
75,944 KB
testcase_19 AC 82 ms
75,956 KB
testcase_20 AC 130 ms
77,024 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 82 ms
75,624 KB
testcase_24 RE -
testcase_25 AC 80 ms
75,640 KB
testcase_26 WA -
testcase_27 AC 129 ms
76,988 KB
testcase_28 WA -
testcase_29 AC 132 ms
77,580 KB
testcase_30 AC 125 ms
77,664 KB
testcase_31 AC 137 ms
77,228 KB
testcase_32 AC 99 ms
76,916 KB
testcase_33 AC 133 ms
77,604 KB
testcase_34 AC 117 ms
77,308 KB
testcase_35 AC 132 ms
77,708 KB
testcase_36 AC 73 ms
71,044 KB
testcase_37 AC 73 ms
71,268 KB
testcase_38 AC 73 ms
71,208 KB
testcase_39 AC 74 ms
70,924 KB
testcase_40 AC 76 ms
71,272 KB
testcase_41 AC 74 ms
71,080 KB
testcase_42 AC 73 ms
70,956 KB
testcase_43 AC 82 ms
75,272 KB
testcase_44 AC 92 ms
76,364 KB
testcase_45 AC 73 ms
71,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w=map(int,input().split())
g=[input() for i in range(h)]
cnt=0
for i in range(h):
    for j in range(w):
        if g[i][j] == '#':
            cnt+=1
if cnt ==0:
    print('NO')
    exit()
    
    

for xz in range(h):
    for yz in range(w):
        if 0 == xz and 0 == yz:
            continue
        f=[[0]*w for i in range(h)]
        ff=0
        for i in range(h):
            for j in range(w):
                if g[i][j] == '#' and f[i][j] == 0:                        
                    if i+xz >= h or j + yz >=w:
                        ff = 1
                        break
                    if g[i+xz][j+yz] != '#':
                        ff = 1
                        break
                    f[i+xz][j+yz] = 1
                    f[i][j] = 1
            if ff == 1:
                break

        if ff == 0:
            print('YES')
            exit()
            
for xz in range(h):
    for yz in range(w):
        xz=-xz
        yz=-yz
        if 0 == xz and 0 == yz:
            continue
        f=[[0]*w for i in range(h)]
        ff=0
        for i in range(h):
            for j in range(w):
                if g[i][j] == '#' and f[i][j] == 0:                        
                    if i+xz < 0 or j + yz < 0:
                        ff = 1
                        break
                    if g[i+xz][j+yz] != '#':
                        ff = 1
                        break
                    f[i+xz][j+yz] = 1
                    f[i][j] = 1
            if ff == 1:
                break

        if ff == 0:
            print('YES')
            exit()

print('NO')
        
            
    
    
0