結果

問題 No.716 距離
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-07-29 14:24:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 8,384 KB
最終ジャッジ日時 2023-09-24 12:24:58
合計ジャッジ時間 6,835 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 230 ms
8,360 KB
testcase_01 AC 233 ms
8,296 KB
testcase_02 AC 228 ms
8,384 KB
testcase_03 AC 224 ms
8,300 KB
testcase_04 AC 234 ms
8,300 KB
testcase_05 AC 215 ms
8,288 KB
testcase_06 AC 231 ms
8,352 KB
testcase_07 AC 16 ms
8,272 KB
testcase_08 AC 16 ms
8,252 KB
testcase_09 AC 15 ms
8,284 KB
testcase_10 AC 158 ms
8,328 KB
testcase_11 AC 58 ms
8,172 KB
testcase_12 AC 216 ms
8,284 KB
testcase_13 AC 142 ms
8,352 KB
testcase_14 AC 16 ms
8,180 KB
testcase_15 AC 196 ms
8,228 KB
testcase_16 AC 87 ms
8,328 KB
testcase_17 AC 210 ms
8,244 KB
testcase_18 AC 19 ms
8,268 KB
testcase_19 AC 68 ms
8,180 KB
testcase_20 AC 16 ms
8,160 KB
testcase_21 AC 20 ms
8,120 KB
testcase_22 AC 38 ms
8,160 KB
testcase_23 AC 18 ms
8,120 KB
testcase_24 AC 164 ms
8,280 KB
testcase_25 AC 58 ms
8,216 KB
testcase_26 AC 101 ms
8,332 KB
testcase_27 AC 121 ms
8,252 KB
testcase_28 AC 17 ms
8,296 KB
testcase_29 AC 103 ms
8,232 KB
testcase_30 AC 101 ms
8,332 KB
testcase_31 AC 143 ms
8,272 KB
testcase_32 AC 122 ms
8,316 KB
testcase_33 AC 110 ms
8,300 KB
testcase_34 AC 78 ms
8,240 KB
testcase_35 AC 15 ms
8,156 KB
testcase_36 AC 28 ms
8,152 KB
testcase_37 AC 16 ms
8,244 KB
testcase_38 AC 48 ms
8,216 KB
testcase_39 AC 106 ms
8,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3


import itertools
import sys


INF = sys.maxsize // 2


def min_max_dist(xs):
    mi, ma = INF, -INF
    for x, y in itertools.combinations(xs, 2):
        d = abs(y - x)
        mi = min(d, mi)
        ma = max(d, ma)
    return mi, ma


def main():
    _ = int(input())
    xs = [int(x) for x in input().split()]
    print(*min_max_dist(xs), sep="\n")


if __name__ == '__main__':
    main()
0