結果

問題 No.640 76本のトロンボーン
ユーザー H3PO4H3PO4
提出日時 2020-10-25 09:56:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 11,016 KB
実行使用メモリ 29,880 KB
最終ジャッジ日時 2023-09-28 22:21:53
合計ジャッジ時間 6,113 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
29,608 KB
testcase_01 AC 130 ms
29,644 KB
testcase_02 AC 129 ms
29,584 KB
testcase_03 AC 129 ms
29,604 KB
testcase_04 AC 129 ms
29,632 KB
testcase_05 AC 128 ms
29,648 KB
testcase_06 WA -
testcase_07 AC 132 ms
29,540 KB
testcase_08 AC 133 ms
29,564 KB
testcase_09 AC 134 ms
29,652 KB
testcase_10 AC 134 ms
29,652 KB
testcase_11 AC 132 ms
29,672 KB
testcase_12 AC 131 ms
29,716 KB
testcase_13 WA -
testcase_14 AC 132 ms
29,540 KB
testcase_15 AC 130 ms
29,616 KB
testcase_16 AC 130 ms
29,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N = int(input())
S = np.array([[s == '.' for s in input()] for _ in range(N)])


def solve(S):
    """左詰め横並べ"""
    left = S[:, -1]
    res = 0
    for i in range(N):
        if np.all(S[i, 1:-1]):
            if S[i, 0]:
                res += 1
            elif S[i, -1]:
                res += 1
                left[i] = False
    if np.all(S[1:-1, -1]) and (S[0, -1] or S[-1, -1]):
        res += 1
    return res


ans = 0
for i in range(4):
    ans = max(ans, solve(S))
    # 回す
    S = np.fliplr(S.T)
print(ans)
0