結果

問題 No.135 とりあえず1次元の問題
ユーザー fV9TwBhUoa9S3eV
提出日時 2019-09-17 11:01:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 463 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 1,179,000 KB
最終ジャッジ日時 2024-07-07 10:24:33
合計ジャッジ時間 12,773 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other MLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.135 とりあえず1次元の問題
def getMin(minimum, nums):
    if len(nums) == 1:
        return 0
    if len(nums) == 2:
        return abs(nums[0] - nums[1])

    first = nums[0]
    others = nums[1:]

    minimun = abs(first - nums[1])

    for i in nums[2:]:
        if minimum > abs(first - i):
            minimum = abs(first - i)

    return getMin(minimum, others)
    
n = int(input())
x = [int(i) for i in input().split()]

print(getMin(0, x))
0