結果

問題 No.3850 作門ハッカソン
コンテスト
ユーザー tyuyu_62
提出日時 2026-12-04 21:40:30
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 137 ms / 2,000 ms
+ 820µs
コード長 1,797 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 89 ms
コンパイル使用メモリ 64,192 KB
実行使用メモリ 77,760 KB
最終ジャッジ日時 2026-12-04 21:40:36
合計ジャッジ時間 5,562 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# Library: https://github.com/tyuyu-62/cp-library
from math import gcd, lcm, isqrt
from collections import deque, defaultdict
from itertools import permutations, product
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop
from random import randint, shuffle
from time import perf_counter as pc
def II(): return int(input())
def LI(dec=0): return [int(x) - dec for x in input().split()]
def SI(): return input()
def LS(): return list(input().split())
mod = 998244353
inf = 2002002002002002002

import sys
sys.setrecursionlimit(10 ** 6)
input = lambda: sys.stdin.readline().rstrip()
_buf = []
def print(*args, sep=" "): _buf.append(sep.join(map(str, args)))
def debug(*args):
    if DEBUG:
        sys.stderr.write(" ".join(map(str, args)) + "\n")
        sys.stderr.flush()
DEBUG = True


def solve():
    H, W = LI()
    S = [SI() for _ in range(H)]
    def check(i, l, r):
        if l == -1: return False
        L = l
        R = r
        while L < R and S[i + 1][L] == ".":
            L += 1
        if L == R:
            return False
        while S[i + 1][R - 1] == ".":
            R -= 1
        if R - L <= 2:
            return False
        for j in range(L + 1, R - 1):
            if S[i + 1][j] != "#":
                return True
        return False

    for i in range(H - 1):
        l = -1
        for j in range(W):
            if S[i][j] == ".":
                if check(i, l, j):
                    print("Yes")
                    return
                l = -1
            elif l == -1:
                l = j
        if check(i, l, W):
            print("Yes")
            return
    print("No")
    return

if __name__ == "__main__":
    T = 1
    T = II()
    for _ in range(T):
        solve()
    sys.stdout.write("\n".join(_buf) + "\n")
0