結果

問題 No.1134 Deviation Score Ⅱ
ユーザー lam6er
提出日時 2025-04-16 00:51:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 84,276 KB
最終ジャッジ日時 2025-04-16 00:53:34
合計ジャッジ時間 2,306 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
x = list(map(int, input().split()))
m = int(input()) - 1  # Convert to 0-based index

sum_x = sum(x)
avg = sum_x / n
sum_x_squared = sum(xi ** 2 for xi in x)

sum_squared_diff = sum_x_squared - 2 * avg * sum_x + n * (avg ** 2)
variance = sum_squared_diff / n

# Handle potential floating point precision issues
if variance < 0:
    variance = 0.0

std_dev = math.sqrt(variance) if variance != 0 else 0.0
x_m = x[m]

if std_dev == 0:
    print(50)
else:
    T = (x_m - avg) * 10 / std_dev
    if x_m > avg:
        deviation = 50 + T
    else:
        deviation = 50 - T
    # Truncate towards zero
    print(int(deviation))
0