結果

問題 No.3802 Crossword Key
コンテスト
ユーザー titia
提出日時 2026-11-16 05:58:15
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 24 ms / 2,000 ms
+ 991µs
コード長 533 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 494 ms
コンパイル使用メモリ 14,720 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2026-11-16 05:58:20
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

H,W=list(map(int,input().split()))

MAP=[input().strip() for i in range(H)]

ANS=set()

for i in range(H):
    for j in range(W):
        if MAP[i][j]==".":
            if i+1<H and MAP[i+1][j]==".":
                if i==0 or MAP[i-1][j]=="#":
                    ANS.add((i+1,j+1))

            if j+1<W and MAP[i][j+1]==".":
                if j==0 or MAP[i][j-1]=="#":
                    ANS.add((i+1,j+1))

ANS=sorted(ANS)

print(len(ANS))
for x,y in ANS:
    print(x,y)
                
0