結果

問題 No.86 TVザッピング(2)
ユーザー vwxyzvwxyz
提出日時 2024-02-27 12:49:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 856 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2024-02-27 12:49:20
合計ジャッジ時間 8,460 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 27 ms
10,112 KB
testcase_02 AC 28 ms
10,112 KB
testcase_03 AC 28 ms
10,112 KB
testcase_04 AC 27 ms
10,112 KB
testcase_05 AC 27 ms
10,112 KB
testcase_06 AC 27 ms
10,112 KB
testcase_07 AC 28 ms
10,112 KB
testcase_08 AC 182 ms
10,240 KB
testcase_09 AC 892 ms
10,240 KB
testcase_10 AC 2,017 ms
10,240 KB
testcase_11 AC 30 ms
10,112 KB
testcase_12 WA -
testcase_13 AC 27 ms
10,112 KB
testcase_14 AC 174 ms
10,240 KB
testcase_15 AC 150 ms
10,240 KB
testcase_16 AC 153 ms
10,240 KB
testcase_17 AC 32 ms
10,112 KB
testcase_18 AC 32 ms
10,112 KB
testcase_19 AC 31 ms
10,112 KB
testcase_20 AC 30 ms
10,112 KB
testcase_21 AC 1,972 ms
10,240 KB
testcase_22 AC 29 ms
10,112 KB
testcase_23 AC 145 ms
10,240 KB
testcase_24 AC 30 ms
10,112 KB
testcase_25 AC 28 ms
10,112 KB
testcase_26 AC 28 ms
10,112 KB
testcase_27 AC 29 ms
10,112 KB
testcase_28 AC 28 ms
10,112 KB
testcase_29 AC 128 ms
10,240 KB
testcase_30 AC 30 ms
10,112 KB
testcase_31 AC 29 ms
10,112 KB
testcase_32 AC 29 ms
10,112 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:
                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