結果

問題 No.1944 ∞
ユーザー gew1fw
提出日時 2025-06-12 14:13:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,772 KB
実行使用メモリ 103,156 KB
最終ジャッジ日時 2025-06-12 14:13:33
合計ジャッジ時間 2,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    idx = 0
    N = int(data[idx])
    idx += 1
    X = int(data[idx])
    idx += 1
    Y = int(data[idx])
    idx += 1
    R = list(map(int, data[idx:idx + N]))
    idx += N
    
    sum_R = sum(R)
    
    if N < 2:
        R_min = R[0]
        R_min2 = R[0]
    else:
        sorted_R = sorted(R)
        R_min = sorted_R[0]
        R_min2 = sorted_R[1] if len(sorted_R) >= 2 else R_min
    
    R_max = max(R)
    
    S_max_total = 2 * sum_R - R_min - R_min2
    S_min_total = R_max - R_min
    
    D = math.hypot(X, Y)
    R_N = R[-1]
    
    lower = abs(D - R_N)
    upper = D + R_N
    
    if S_min_total <= upper and S_max_total >= lower:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
0