結果

問題 No.609 Noelちゃんと星々
ユーザー kichirb3kichirb3
提出日時 2018-03-24 01:58:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 21,352 KB
最終ジャッジ日時 2023-09-07 08:16:15
合計ジャッジ時間 3,462 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
18,588 KB
testcase_01 AC 58 ms
14,672 KB
testcase_02 AC 50 ms
13,584 KB
testcase_03 AC 57 ms
14,600 KB
testcase_04 AC 46 ms
12,292 KB
testcase_05 AC 101 ms
20,412 KB
testcase_06 AC 90 ms
19,156 KB
testcase_07 AC 65 ms
15,420 KB
testcase_08 AC 40 ms
11,324 KB
testcase_09 AC 53 ms
13,572 KB
testcase_10 AC 74 ms
16,904 KB
testcase_11 AC 71 ms
16,288 KB
testcase_12 AC 82 ms
17,844 KB
testcase_13 AC 41 ms
11,856 KB
testcase_14 AC 37 ms
10,928 KB
testcase_15 AC 96 ms
19,220 KB
testcase_16 AC 104 ms
20,620 KB
testcase_17 AC 86 ms
18,332 KB
testcase_18 AC 50 ms
13,392 KB
testcase_19 AC 91 ms
18,932 KB
testcase_20 AC 106 ms
21,156 KB
testcase_21 AC 106 ms
21,288 KB
testcase_22 AC 105 ms
21,196 KB
testcase_23 AC 105 ms
21,352 KB
testcase_24 AC 108 ms
21,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.609 Noelちゃんと星々
https://yukicoder.me/problems/no/609

"""
import sys
from sys import stdin
from statistics import median
input = stdin.readline


def solve(stars):
    stars.sort()
    m = int(median(stars))
    res = [abs(x - m) for x in stars]
    return sum(res)


def main(args):
    _ = input()
    stars = [int(x) for x in input().split()]
    ans = solve(stars)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0