結果

問題 No.1134 Deviation Score Ⅱ
ユーザー gew1fw
提出日時 2025-06-12 15:41:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 83,032 KB
実行使用メモリ 83,652 KB
最終ジャッジ日時 2025-06-12 15:41:21
合計ジャッジ時間 3,436 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
x = list(map(int, input().split()))
m = int(input())

# Check if all elements are equal
first = x[0]
all_equal = True
for xi in x:
    if xi != first:
        all_equal = False
        break

if all_equal:
    print(50)
else:
    # Compute average
    avg = sum(x) / n
    # Compute sum of squared differences
    sum_sq = 0.0
    for xi in x:
        diff = xi - avg
        sum_sq += diff * diff
    variance = sum_sq / n
    std_dev = math.sqrt(variance)
    
    # Get x_m
    x_m = x[m-1]
    diff_x = x_m - avg
    
    # Compute t
    t = (10 * diff_x) / std_dev
    
    if diff_x > 0:
        deviation = 50 + t
    else:
        deviation = 50 - t
    
    # Floor the deviation and print as integer
    result = math.floor(deviation)
    print(int(result))
0