結果

問題 No.609 Noelちゃんと星々
ユーザー DexctersuDexctersu
提出日時 2018-01-29 17:49:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 175 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,552 KB
実行使用メモリ 18,988 KB
最終ジャッジ日時 2023-08-28 15:20:50
合計ジャッジ時間 2,971 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
16,344 KB
testcase_01 AC 45 ms
12,152 KB
testcase_02 AC 35 ms
10,820 KB
testcase_03 AC 43 ms
11,852 KB
testcase_04 AC 29 ms
9,872 KB
testcase_05 AC 96 ms
18,468 KB
testcase_06 AC 81 ms
16,908 KB
testcase_07 AC 53 ms
13,344 KB
testcase_08 AC 22 ms
9,304 KB
testcase_09 AC 38 ms
11,388 KB
testcase_10 AC 62 ms
14,428 KB
testcase_11 AC 59 ms
14,124 KB
testcase_12 AC 72 ms
15,644 KB
testcase_13 AC 25 ms
9,416 KB
testcase_14 AC 19 ms
8,708 KB
testcase_15 AC 83 ms
17,216 KB
testcase_16 AC 94 ms
18,664 KB
testcase_17 AC 77 ms
16,432 KB
testcase_18 AC 35 ms
10,780 KB
testcase_19 AC 81 ms
17,060 KB
testcase_20 AC 99 ms
18,776 KB
testcase_21 AC 96 ms
18,988 KB
testcase_22 AC 96 ms
18,916 KB
testcase_23 AC 95 ms
18,828 KB
testcase_24 AC 95 ms
18,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
y=list(map(int,input().split()))
y.sort()
if n%2!=0:
    med=y[n//2]
else:
    med=(y[n//2]+y[n//2-1])//2
k=0
for i in range(n):
    k+=(abs(y[i]-med))
print(k)
0