結果

問題 No.609 Noelちゃんと星々
ユーザー lemonlemon
提出日時 2021-05-15 10:40:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,780 KB
最終ジャッジ日時 2024-04-10 15:09:46
合計ジャッジ時間 3,969 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
18,924 KB
testcase_01 AC 63 ms
14,780 KB
testcase_02 AC 47 ms
13,560 KB
testcase_03 AC 55 ms
14,736 KB
testcase_04 AC 40 ms
12,500 KB
testcase_05 AC 112 ms
20,720 KB
testcase_06 AC 96 ms
19,412 KB
testcase_07 AC 66 ms
15,672 KB
testcase_08 AC 34 ms
11,648 KB
testcase_09 AC 51 ms
13,980 KB
testcase_10 AC 77 ms
17,140 KB
testcase_11 AC 75 ms
16,588 KB
testcase_12 AC 89 ms
18,124 KB
testcase_13 AC 38 ms
12,032 KB
testcase_14 AC 32 ms
11,264 KB
testcase_15 AC 95 ms
19,684 KB
testcase_16 AC 106 ms
21,188 KB
testcase_17 AC 90 ms
18,912 KB
testcase_18 AC 49 ms
13,340 KB
testcase_19 AC 96 ms
19,412 KB
testcase_20 AC 108 ms
21,752 KB
testcase_21 AC 109 ms
21,748 KB
testcase_22 AC 114 ms
21,748 KB
testcase_23 AC 111 ms
21,780 KB
testcase_24 AC 108 ms
21,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 * 9 + 7
inf = 2 << 60

n = ni()
Y = sorted(na())

mid = n // 2
ans = 0
for y in Y:
    ans += abs(y - Y[mid])

print(ans)
0