結果

問題 No.86 TVザッピング(2)
ユーザー vwxyzvwxyz
提出日時 2024-02-27 12:50:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 342 ms / 5,000 ms
コード長 882 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 78,008 KB
最終ジャッジ日時 2024-02-27 12:50:49
合計ジャッジ時間 4,670 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 52 ms
53,460 KB
testcase_08 AC 146 ms
77,220 KB
testcase_09 AC 274 ms
77,504 KB
testcase_10 AC 285 ms
76,912 KB
testcase_11 AC 46 ms
61,700 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 181 ms
77,516 KB
testcase_15 AC 175 ms
76,968 KB
testcase_16 AC 147 ms
76,972 KB
testcase_17 AC 57 ms
66,160 KB
testcase_18 AC 57 ms
66,404 KB
testcase_19 AC 51 ms
64,060 KB
testcase_20 AC 41 ms
59,580 KB
testcase_21 AC 342 ms
78,008 KB
testcase_22 AC 38 ms
53,460 KB
testcase_23 AC 136 ms
77,344 KB
testcase_24 AC 41 ms
55,596 KB
testcase_25 AC 36 ms
53,460 KB
testcase_26 AC 38 ms
53,460 KB
testcase_27 AC 36 ms
53,460 KB
testcase_28 AC 36 ms
53,460 KB
testcase_29 AC 122 ms
77,176 KB
testcase_30 AC 36 ms
53,460 KB
testcase_31 AC 39 ms
53,460 KB
testcase_32 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
S=[input() for h in range(H)]
ans="NO"
cnt=0
for h in range(H):
    for w in range(W):
        if S[h][w]==".":
            cnt+=1
for _ in range(4):
    for h in range(H-1):
        for w in range(W-1):
            lh,rw=h,w+1
            while lh and S[lh-1][w]==".":
                lh-=1
            while rw<W and S[lh][rw]==".":
                rw+=1
            lw,rh=w,h+1
            while lw and S[h][lw-1]==".":
                lw-=1
            while rh<H and S[rh][lw]==".":
                rh+=1
            if any(S[i][rw-1]=="#" for i in range(lh,rh)):
                continue
            if any(S[rh-1][i]=="#" for i in range(lw,rw)):
                continue
            if ((rh-lh)+(rw-lw)-2)*2==cnt and rh-lh>=2 and rw-lw>=2:
                ans="YES"
    S=[[S[h][W-1-w] for h in range(H)] for w in range(W)]
    H,W=W,H
print(ans)
0