結果

問題 No.1265 Balloon Survival
ユーザー lam6er
提出日時 2025-03-31 17:37:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,021 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 67,948 KB
最終ジャッジ日時 2025-03-31 17:38:22
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    n = int(data[0])
    x = []
    y = []
    for i in range(n):
        x.append(int(data[1 + 2*i]))
        y.append(int(data[2 + 2*i]))
    
    x1 = x[0]
    y1 = y[0]
    
    # Compute d_i for each i != 0
    d = []
    for i in range(1, n):
        dx = x[i] - x1
        dy = y[i] - y1
        di = math.hypot(dx, dy)
        d.append(di)
    
    ans = 0
    
    for i in range(len(d)):
        di = d[i]
        has_partner = False
        xi = x[1 + i]
        yi = y[1 + i]
        for j in range(len(d)):
            if j == i:
                continue
            dj = d[j]
            xj = x[1 + j]
            yj = y[1 + j]
            dx = xi - xj
            dy = yi - yj
            dij = math.hypot(dx, dy)
            if dij < min(di, dj):
                has_partner = True
                break
        if not has_partner:
            ans += 1
    
    print(ans)

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