結果
| 問題 | No.609 Noelちゃんと星々 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 20:52:56 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 93 ms / 2,000 ms |
| + 361µs | |
| コード長 | 421 bytes |
| 記録 | |
| コンパイル時間 | 58 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 28,148 KB |
| 最終ジャッジ日時 | 2026-10-02 10:09:47 |
| 合計ジャッジ時間 | 4,107 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
from collections import Counter
from bisect import bisect
def main():
N = int(input())
Y = tuple(map(int, input().split()))
if N == 1:
print(0)
return
c = Counter(Y).most_common()
y = sorted(Y)
idx = N // 2
dist = float('inf')
for i in (c[0][0], y[idx]):
n = 0
for j in y:
n += abs(i - j)
dist = min(dist, n)
print(dist)
main()