結果

問題 No.640 76本のトロンボーン
ユーザー maspymaspy
提出日時 2020-03-23 19:44:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 29,548 KB
最終ジャッジ日時 2023-08-27 06:57:54
合計ジャッジ時間 3,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
29,528 KB
testcase_01 AC 126 ms
29,448 KB
testcase_02 AC 126 ms
29,376 KB
testcase_03 WA -
testcase_04 AC 128 ms
29,448 KB
testcase_05 AC 124 ms
29,508 KB
testcase_06 WA -
testcase_07 AC 129 ms
29,404 KB
testcase_08 AC 123 ms
29,504 KB
testcase_09 AC 125 ms
29,448 KB
testcase_10 AC 125 ms
29,404 KB
testcase_11 AC 125 ms
29,296 KB
testcase_12 AC 126 ms
29,548 KB
testcase_13 WA -
testcase_14 AC 125 ms
29,448 KB
testcase_15 AC 127 ms
29,452 KB
testcase_16 AC 125 ms
29,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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
                S[0, 1:] = b','


print(max(solve(S)))
0