結果
| 問題 | No.640 76本のトロンボーン | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-03-23 19:43:02 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 744 bytes | 
| コンパイル時間 | 557 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 73,068 KB | 
| 最終ジャッジ日時 | 2024-12-26 18:25:19 | 
| 合計ジャッジ時間 | 16,625 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 WA * 3 | 
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :N].copy()
def solve_vertical(S):
    H, W = S.shape
    cond_1 = np.all(S[:-1] == b'.', axis=0)
    cond_2 = np.all(S[1:] == b'.', axis=0)
    return np.count_nonzero(cond_1 | cond_2)
def solve(S):
    yield solve_vertical(S)
    yield solve_vertical(S.T)
    for _ in range(2):
        S = S.T
        for _ in range(4):
            S = S[::-1].T
            if np.all(S[0, 1:] == b'.'):
                S[0, 1:] = b'#'
                for x in solve(S):
                    yield x + 1
print(max(solve(S)))
            
            
            
        