結果

問題 No.944 煎っぞ!
ユーザー sakuraigakusakuraigaku
提出日時 2019-12-15 12:36:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 835 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 19,512 KB
最終ジャッジ日時 2023-09-15 15:32:17
合計ジャッジ時間 10,286 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy

def isOneTypeInList(list):
    for t in list:
        if list.count(t) <= 1:
            return False
    return True

def roast(list, i):
    l = copy.deepcopy(list)
    j = l.pop(i)
    k = l.pop(i)
    l.insert(i,j+k)
    return l


def loop(list):
    if len(list) <= 1:
        return len(list)
    elif isOneTypeInList(list):
        return len(list)
    elif len(list) == 2:
        return 1
    else:
        minIndex = list.index(min(list))
        if minIndex == 0:
            return loop(roast(list, minIndex))
        elif minIndex == len(list) - 1:
            return loop(roast(list, minIndex - 1))
        else:
            f = loop(roast(list, minIndex))
            b = loop(roast(list, minIndex - 1))
            return max(f,b)



n = input()
beans = list(map(int, input().split()))

print(loop(beans))
0