結果

問題 No.609 Noelちゃんと星々
ユーザー 12354865271235486527
提出日時 2019-12-21 11:36:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 18,848 KB
最終ジャッジ日時 2023-09-26 10:04:24
合計ジャッジ時間 4,606 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
16,328 KB
testcase_01 AC 46 ms
12,132 KB
testcase_02 AC 36 ms
10,628 KB
testcase_03 AC 43 ms
11,924 KB
testcase_04 AC 28 ms
9,720 KB
testcase_05 AC 96 ms
18,356 KB
testcase_06 AC 85 ms
16,872 KB
testcase_07 AC 54 ms
13,292 KB
testcase_08 AC 23 ms
9,300 KB
testcase_09 AC 39 ms
11,196 KB
testcase_10 AC 64 ms
14,468 KB
testcase_11 AC 62 ms
14,196 KB
testcase_12 AC 75 ms
15,592 KB
testcase_13 AC 26 ms
9,468 KB
testcase_14 AC 19 ms
8,636 KB
testcase_15 AC 91 ms
17,108 KB
testcase_16 AC 98 ms
18,592 KB
testcase_17 AC 81 ms
16,352 KB
testcase_18 AC 35 ms
10,596 KB
testcase_19 AC 85 ms
16,960 KB
testcase_20 AC 102 ms
18,796 KB
testcase_21 AC 103 ms
18,796 KB
testcase_22 AC 101 ms
18,848 KB
testcase_23 AC 99 ms
18,792 KB
testcase_24 AC 100 ms
18,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
Y = list(map(int, input().split()))
Y.sort()
if N & 1 == 1:
    m = Y[N//2]
else:
    m = (Y[N//2 - 1] + Y[N//2] + 1) // 2
s = 0
for i in range(N):
    s += abs(m - Y[i])
print(s)
0