結果

問題 No.609 Noelちゃんと星々
ユーザー takakintakakin
提出日時 2020-05-24 20:53:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,640 KB
最終ジャッジ日時 2024-04-20 10:46:47
合計ジャッジ時間 3,192 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
18,964 KB
testcase_01 AC 63 ms
14,740 KB
testcase_02 AC 50 ms
13,492 KB
testcase_03 AC 57 ms
14,528 KB
testcase_04 AC 42 ms
12,496 KB
testcase_05 AC 107 ms
20,852 KB
testcase_06 AC 93 ms
19,408 KB
testcase_07 AC 64 ms
15,800 KB
testcase_08 AC 36 ms
11,648 KB
testcase_09 AC 52 ms
13,924 KB
testcase_10 AC 76 ms
17,132 KB
testcase_11 AC 73 ms
16,576 KB
testcase_12 AC 84 ms
18,252 KB
testcase_13 AC 39 ms
12,160 KB
testcase_14 AC 34 ms
11,264 KB
testcase_15 AC 93 ms
19,680 KB
testcase_16 AC 108 ms
21,180 KB
testcase_17 AC 91 ms
19,064 KB
testcase_18 AC 50 ms
13,336 KB
testcase_19 AC 94 ms
19,536 KB
testcase_20 AC 112 ms
21,640 KB
testcase_21 AC 109 ms
21,512 KB
testcase_22 AC 107 ms
21,508 KB
testcase_23 AC 108 ms
21,516 KB
testcase_24 AC 110 ms
21,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
Y=[int(i) for i in input().split()]

def f(x):
  ret=0
  for y in Y:
    ret+=abs(y-x)
  return ret
Y.sort()
print(f(Y[n//2]))
0