結果

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

ソースコード

diff #
raw source code

H, W = map(int, input().split())
G = [['#'] * (W + 1) for _ in range(H + 1)]
for i in range(1, H + 1):
    s = input()
    for j in range(W):
        G[i][j + 1] = s[j]

ans = set()
for i in range(1, H + 1):
    for j in range(1, W):
        # 左が# で 右が . な . のマス
        if G[i][j - 1] == '#' and G[i][j] == '.' and G[i][j + 1] == '.':
            ans.add((i, j))

for j in range(1, W + 1):
    for i in range(1, H):
        if G[i - 1][j] == '#' and G[i][j] == '.' and G[i + 1][j] == '.':
            ans.add((i, j))

ans = sorted(ans)
print(len(ans))
for a in ans:
    print(*a)
0