結果

問題 No.1031 いたずら好きなお姉ちゃん
ユーザー MNGOFMNGOF
提出日時 2020-04-26 22:13:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 683 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 119,576 KB
最終ジャッジ日時 2024-04-29 10:12:39
合計ジャッジ時間 58,936 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 561 ms
119,576 KB
testcase_01 AC 559 ms
44,208 KB
testcase_02 AC 548 ms
44,088 KB
testcase_03 AC 581 ms
44,336 KB
testcase_04 AC 589 ms
44,472 KB
testcase_05 AC 616 ms
44,216 KB
testcase_06 AC 618 ms
44,212 KB
testcase_07 AC 607 ms
44,344 KB
testcase_08 AC 578 ms
44,464 KB
testcase_09 AC 585 ms
44,588 KB
testcase_10 AC 616 ms
44,344 KB
testcase_11 AC 1,836 ms
47,548 KB
testcase_12 AC 1,789 ms
47,552 KB
testcase_13 AC 2,112 ms
49,208 KB
testcase_14 AC 1,870 ms
48,016 KB
testcase_15 AC 2,026 ms
48,308 KB
testcase_16 AC 1,815 ms
47,800 KB
testcase_17 AC 1,963 ms
48,432 KB
testcase_18 AC 1,935 ms
47,928 KB
testcase_19 AC 1,994 ms
48,308 KB
testcase_20 AC 2,105 ms
48,564 KB
testcase_21 AC 1,911 ms
47,928 KB
testcase_22 AC 1,752 ms
48,180 KB
testcase_23 AC 1,897 ms
47,416 KB
testcase_24 AC 2,064 ms
49,072 KB
testcase_25 AC 2,073 ms
48,696 KB
testcase_26 AC 1,977 ms
48,056 KB
testcase_27 AC 1,856 ms
47,792 KB
testcase_28 AC 2,061 ms
49,848 KB
testcase_29 AC 2,088 ms
49,080 KB
testcase_30 AC 2,096 ms
49,204 KB
testcase_31 AC 2,132 ms
49,588 KB
testcase_32 AC 2,082 ms
48,944 KB
testcase_33 AC 2,119 ms
49,600 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def solve(area):
    if area.shape[0] <= 1:
        return 0
    selected_ind = area*0
    max_ind = np.argmax(area)
    min_ind = max_ind
    for i in reversed(range(max_ind)):
        if area[min_ind] > area[i]:
            min_ind = i
            selected_ind[i] = 1
    min_ind = max_ind
    for i in range(max_ind+1, area.shape[0]):
        if area[min_ind] > area[i]:
            min_ind = i
            selected_ind[i] = 1
    count = np.sum(selected_ind)
    count += solve(area[0:max_ind])
    count += solve(area[max_ind+1:area.shape[0]])
    return count


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

print(solve(input_np))
0