結果

問題 No.3805 Crossword Key Maker
ユーザー kidodesu
提出日時 2026-11-14 15:20:17
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 57 ms / 2,000 ms
+ 952µs
コード長 871 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 81 ms
コンパイル使用メモリ 64,552 KB
実行使用メモリ 60,652 KB
最終ジャッジ日時 2026-11-14 15:20:22
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    h, w = list(map(int, input().split()))
    S = ["#"*(w+2)] + ["#"+input()+"#" for _ in range(h)] + ["#"*(w+2)]
    h += 2
    w += 2
    A = [[S[y][x] for x in range(w)] for y in range(h)]
    Ans = []
    for y in range(1, h-1):
        for x in range(1, w-1):
            f0 = f1 = 0
            s0 = s1 = "-"
            if S[y][x-1] + S[y][x] + S[y][x+1] == "#..":
                f0 = 1
                nx = x
                while S[y][nx] == ".":
                    nx += 1
                s0 = "a"*(nx-x)
            if S[y-1][x] + S[y][x] + S[y+1][x] == "#..":
                f1 = 1
                ny = y
                while S[ny][x] == ".":
                    ny += 1
                s1 = "a"*(ny-y)
            if f0 or f1:
                Ans.append((s0, s1))
    
    print(len(Ans))
    for s0, s1 in Ans:
        print(s0, s1)

main()
0