結果
| 問題 | No.609 Noelちゃんと星々 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 11:04:29 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 481 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 20,456 KB |
| 最終ジャッジ日時 | 2026-10-02 08:16:30 |
| 合計ジャッジ時間 | 11,309 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 24 |
ソースコード
from collections import Counter
def main():
N = int(input())
Y = tuple(map(int, input().split()))
if N == 1:
print(Y[0])
return
elif N == 2:
print(max(Y) - min(Y))
return
else:
c = Counter(Y)
dist = float('inf')
for i, j in c.items():
ref = i
n = 0
for k, l in c.items():
n += abs(ref - k) * l
dist = min(dist, n)
print(dist)
main()