結果
| 問題 |
No.609 Noelちゃんと星々
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 10:14:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 496 bytes |
| コンパイル時間 | 95 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 28,776 KB |
| 最終ジャッジ日時 | 2024-11-30 02:11:14 |
| 合計ジャッジ時間 | 4,190 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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:
n = Y[:]
else:
n = sorted(Y)
max_i = n.index(max(n))
n = n[:max_i][::-1]
min_i = n.index(min(n))
n = n[:min_i]
counter = Counter(n)
reference = counter.most_common()[0][0]
dist = 0
for i in Y:
dist += abs(reference - i)
print(dist)
main()