結果

問題 No.1944 ∞
ユーザー lam6er
提出日時 2025-04-16 15:51:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,212 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,092 KB
実行使用メモリ 102,592 KB
最終ジャッジ日時 2025-04-16 15:52:34
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    
    N = int(data[0])
    X = int(data[1])
    Y = int(data[2])
    R = list(map(int, data[3:3+N]))
    
    if N == 0:
        print("No")
        return
    
    R_max = max(R)
    sum_rest = sum(R) - R_max
    max_dist = R_max + sum_rest
    min_dist = abs(R_max - sum_rest)
    
    S = math.sqrt(X**2 + Y**2)
    
    found = False
    for r_last in R:
        # Check condition 1: S - r_last is between min_dist and max_dist
        cond1 = (S - r_last >= min_dist - 1e-9) and (S - r_last <= max_dist + 1e-9)
        # Check condition 2: S + r_last is between min_dist and max_dist
        cond2 = (S + r_last >= min_dist - 1e-9) and (S + r_last <= max_dist + 1e-9)
        # Check condition 3: r_last >= S and (r_last - S) is between min_dist and max_dist
        cond3 = False
        if r_last >= S - 1e-9:
            diff = r_last - S
            if (diff >= min_dist - 1e-9) and (diff <= max_dist + 1e-9):
                cond3 = True
        
        if cond1 or cond2 or cond3:
            found = True
            break
    
    print("Yes" if found else "No")

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