結果

問題 No.609 Noelちゃんと星々
ユーザー daku9640daku9640
提出日時 2018-08-12 01:30:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 11,824 KB
実行使用メモリ 21,136 KB
最終ジャッジ日時 2023-10-24 14:18:15
合計ジャッジ時間 3,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
18,332 KB
testcase_01 AC 54 ms
14,168 KB
testcase_02 AC 45 ms
13,508 KB
testcase_03 AC 51 ms
13,876 KB
testcase_04 AC 40 ms
12,364 KB
testcase_05 AC 93 ms
20,416 KB
testcase_06 AC 82 ms
19,092 KB
testcase_07 AC 59 ms
15,324 KB
testcase_08 AC 35 ms
11,196 KB
testcase_09 AC 48 ms
13,804 KB
testcase_10 AC 68 ms
16,760 KB
testcase_11 AC 66 ms
16,100 KB
testcase_12 AC 75 ms
17,924 KB
testcase_13 AC 36 ms
11,520 KB
testcase_14 AC 32 ms
10,684 KB
testcase_15 AC 86 ms
19,108 KB
testcase_16 AC 96 ms
20,624 KB
testcase_17 AC 81 ms
18,348 KB
testcase_18 AC 45 ms
13,472 KB
testcase_19 AC 82 ms
19,092 KB
testcase_20 AC 97 ms
21,136 KB
testcase_21 AC 96 ms
21,136 KB
testcase_22 AC 96 ms
21,136 KB
testcase_23 AC 96 ms
21,136 KB
testcase_24 AC 97 ms
21,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect, insort_left, insort
from itertools import accumulate
n = int(input())
y = sorted(map(int, input().split()))
sum_y = tuple(accumulate(y))
med = y[n//2]
l = bisect_left(y, med)
print(abs(sum_y[l - 1] - med * l) + abs((sum_y[-1] - sum_y[l - 1]) - med * (n - l)))
0