結果

問題 No.944 煎っぞ!
ユーザー sakuraigaku
提出日時 2019-12-15 12:36:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 835 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 23,924 KB
最終ジャッジ日時 2024-07-02 18:12:55
合計ジャッジ時間 9,209 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 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