結果

問題 No.609 Noelちゃんと星々
ユーザー KozumaKozuma
提出日時 2018-01-17 23:20:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 19,024 KB
最終ジャッジ日時 2023-08-25 23:09:03
合計ジャッジ時間 2,604 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
16,336 KB
testcase_01 AC 40 ms
12,164 KB
testcase_02 AC 30 ms
10,732 KB
testcase_03 AC 37 ms
11,924 KB
testcase_04 AC 25 ms
9,992 KB
testcase_05 AC 82 ms
18,568 KB
testcase_06 AC 69 ms
17,020 KB
testcase_07 AC 44 ms
13,492 KB
testcase_08 AC 19 ms
9,336 KB
testcase_09 AC 35 ms
11,292 KB
testcase_10 AC 53 ms
14,428 KB
testcase_11 AC 50 ms
14,284 KB
testcase_12 AC 60 ms
15,672 KB
testcase_13 AC 21 ms
9,548 KB
testcase_14 AC 15 ms
8,856 KB
testcase_15 AC 70 ms
17,280 KB
testcase_16 AC 83 ms
18,740 KB
testcase_17 AC 66 ms
16,496 KB
testcase_18 AC 30 ms
10,748 KB
testcase_19 AC 70 ms
16,964 KB
testcase_20 AC 81 ms
19,024 KB
testcase_21 AC 84 ms
18,892 KB
testcase_22 AC 83 ms
18,944 KB
testcase_23 AC 83 ms
18,892 KB
testcase_24 AC 82 ms
18,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
Y = list(map(int, input().split()))

Y.sort()

sum = 0
if N % 2 != 0:
	center = Y[int(N / 2)]
else:
	center = int((Y[int(N / 2) - 1] + Y[int(N / 2)]) / 2)
	

for i in Y:
		sum += abs(i - center)

print(sum)
	
0