結果

問題 No.1944 ∞
ユーザー lam6er
提出日時 2025-04-15 22:09:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,142 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 112,892 KB
最終ジャッジ日時 2025-04-15 22:10:38
合計ジャッジ時間 3,542 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from collections import Counter

def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    N = int(input[idx])
    idx += 1
    X = int(input[idx])
    idx += 1
    Y = int(input[idx])
    idx += 1
    R = list(map(int, input[idx:idx+N]))
    idx += N

    sum_total = sum(R)
    OP = math.sqrt(X ** 2 + Y ** 2)
    min_r = min(R)
    count = Counter(R)

    for r_last in R:
        candidates = []
        if count[r_last] >= 2:
            candidates.append(r_last)
        if min_r != r_last or count[r_last] >= 2:
            candidates.append(min_r)
        # Remove duplicates
        candidates = list(set(candidates))
        for r_first in candidates:
            if r_first == r_last and count[r_last] < 2:
                continue
            min_D = r_first + r_last
            max_D = 2 * sum_total - r_first - r_last
            lower = OP - r_last
            upper = OP + r_last
            left = max(min_D, lower)
            right = min(max_D, upper)
            if left <= right:
                print("Yes")
                return
    print("No")

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