結果
| 問題 | No.609 Noelちゃんと星々 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 10:52:36 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| 記録 | |
| コンパイル時間 | 718 ms |
| コンパイル使用メモリ | 20,820 KB |
| 実行使用メモリ | 31,204 KB |
| 最終ジャッジ日時 | 2026-05-23 19:10:23 |
| 合計ジャッジ時間 | 6,062 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 25 |
ソースコード
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).most_common()
if len(c) == 2:
ref = c[0][0]
else:
ref = sorted(c)[1:-1]
ref = sorted(ref, key=lambda x: x[1])[0][0]
dist = 0
for i, j in c:
dist += abs(ref - i) * j
print(dist)
main()