結果

問題 No.1031 いたずら好きなお姉ちゃん
ユーザー MNGOFMNGOF
提出日時 2020-04-26 23:12:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 746 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 97,612 KB
最終ジャッジ日時 2024-11-18 20:51:37
合計ジャッジ時間 140,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def solve2(area):
    next_area = area
    count = 0
    while True:
        max_ind = np.argmax(next_area)
        min_ind = np.argmin(next_area)
        if max_ind == min_ind:
            break
        next_area = next_area[0:min_ind] if max_ind < min_ind else next_area[min_ind + 1: next_area.shape[0]]
        count += 1
    max_ind = np.argmax(area)
    if max_ind == 2:
        count += 1
    elif max_ind > 2:
        count += solve2(area[0:max_ind])

    if (area.shape[0] - max_ind) == 3:
        count += 1
    elif (area.shape[0] - max_ind) > 3:
        count += solve2(area[max_ind + 1: area.shape[0]])
    return count
    

N = int(input())
data = np.array(input().split()).astype(np.int32)

print(solve2(data))
0