結果

問題 No.609 Noelちゃんと星々
ユーザー Naoyk1212Naoyk1212
提出日時 2017-12-14 18:26:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 165 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 21,400 KB
最終ジャッジ日時 2023-08-21 04:36:05
合計ジャッジ時間 3,498 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
18,448 KB
testcase_01 AC 62 ms
14,468 KB
testcase_02 AC 52 ms
13,232 KB
testcase_03 AC 59 ms
14,352 KB
testcase_04 AC 45 ms
12,076 KB
testcase_05 AC 109 ms
20,620 KB
testcase_06 AC 98 ms
19,224 KB
testcase_07 AC 71 ms
15,536 KB
testcase_08 AC 39 ms
11,224 KB
testcase_09 AC 55 ms
13,396 KB
testcase_10 AC 81 ms
16,528 KB
testcase_11 AC 76 ms
16,224 KB
testcase_12 AC 87 ms
18,172 KB
testcase_13 AC 41 ms
11,652 KB
testcase_14 AC 35 ms
10,732 KB
testcase_15 AC 98 ms
19,400 KB
testcase_16 AC 111 ms
20,848 KB
testcase_17 AC 93 ms
18,628 KB
testcase_18 AC 52 ms
13,060 KB
testcase_19 AC 97 ms
19,040 KB
testcase_20 AC 113 ms
21,396 KB
testcase_21 AC 113 ms
21,356 KB
testcase_22 AC 112 ms
21,364 KB
testcase_23 AC 112 ms
21,192 KB
testcase_24 AC 112 ms
21,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from statistics import median

N = int(input())
Y = [int(x) for x in input().split()]

med = int(median(Y))

ans = 0
for i in Y:
    ans += abs(med - i)

print(ans)
0