結果

問題 No.609 Noelちゃんと星々
ユーザー roarisroaris
提出日時 2019-07-26 11:31:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 19,332 KB
最終ジャッジ日時 2023-09-15 00:14:04
合計ジャッジ時間 3,824 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
16,344 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 37 ms
11,996 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 46 ms
13,496 KB
testcase_08 AC 21 ms
9,316 KB
testcase_09 AC 34 ms
11,340 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 61 ms
16,040 KB
testcase_13 WA -
testcase_14 AC 19 ms
8,832 KB
testcase_15 WA -
testcase_16 AC 81 ms
18,636 KB
testcase_17 AC 67 ms
16,380 KB
testcase_18 AC 31 ms
10,804 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def median(seq):
    if N % 2 == 1:
        return seq[(N-1)//2]
    else:
        return (seq[N//2-1]+seq[N//2]) / 2

N = int(input())
Y = list(sorted((map(int, input().split()))))
med = median(Y)
ans = sum(abs(Y_i - med) for Y_i in Y)

print(ans)
0