結果

問題 No.1031 いたずら好きなお姉ちゃん
ユーザー MNGOFMNGOF
提出日時 2020-04-26 23:16:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 836 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 270,816 KB
最終ジャッジ日時 2024-04-29 16:06:19
合計ジャッジ時間 12,851 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 43 ms
51,968 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 92 ms
76,032 KB
testcase_04 AC 94 ms
76,416 KB
testcase_05 AC 94 ms
76,672 KB
testcase_06 AC 93 ms
76,032 KB
testcase_07 AC 99 ms
76,416 KB
testcase_08 AC 93 ms
76,160 KB
testcase_09 AC 90 ms
76,288 KB
testcase_10 AC 91 ms
75,904 KB
testcase_11 AC 237 ms
88,448 KB
testcase_12 AC 215 ms
87,680 KB
testcase_13 AC 239 ms
91,408 KB
testcase_14 AC 242 ms
88,396 KB
testcase_15 AC 261 ms
90,880 KB
testcase_16 AC 216 ms
89,600 KB
testcase_17 AC 251 ms
88,832 KB
testcase_18 AC 249 ms
92,544 KB
testcase_19 AC 230 ms
93,952 KB
testcase_20 AC 235 ms
93,952 KB
testcase_21 AC 221 ms
89,088 KB
testcase_22 AC 240 ms
88,448 KB
testcase_23 AC 230 ms
87,780 KB
testcase_24 AC 229 ms
92,800 KB
testcase_25 AC 253 ms
91,392 KB
testcase_26 AC 256 ms
91,136 KB
testcase_27 AC 220 ms
89,344 KB
testcase_28 AC 257 ms
91,904 KB
testcase_29 AC 234 ms
94,976 KB
testcase_30 AC 236 ms
93,824 KB
testcase_31 AC 230 ms
92,800 KB
testcase_32 AC 230 ms
93,312 KB
testcase_33 AC 233 ms
93,824 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 #

def solve(area):
    next_area = list(area)
    if len(next_area) <= 1:
        return 0
    elif len(next_area) == 2:
        return 1
    count = 0
    while True:
        max_ind = next_area.index(max(next_area))
        min_ind = next_area.index(min(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: len(next_area)]
        count += 1
    max_ind = area.index(max(area))
    if max_ind == 2:
        count += 1
    elif max_ind > 2:
        count += solve(area[0:max_ind])

    if (len(area) - max_ind) == 3:
        count += 1
    elif (len(area) - max_ind) > 3:
        count += solve(area[max_ind + 1: len(area)])
    return count
    

N = int(input())
data = input().split()
Input = [int(s) for s in data]

print(solve(Input))
0