結果
問題 | No.1265 Balloon Survival |
ユーザー |
|
提出日時 | 2022-02-19 16:32:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,218 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 151,116 KB |
最終ジャッジ日時 | 2024-06-29 10:27:26 |
合計ジャッジ時間 | 15,955 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
N = int(input())x = [0] * Ny = [0] * Nfor i in range(N):x[i],y[i] = map(int,input().split())l = []for i in range(N):for j in range(i+1,N):s = (x[i]-x[j]) ** 2t = (y[i]-y[j]) ** 2l.append((s+t,i,j))l.sort(key = lambda x:x[0])s = set()ans = 0for d,i,j in l:if i == 0 or j == 0:if j == 0:i,j = j,iif j not in s:ans += 1s.add(j)else:if i not in s and j not in s:s.add(i)s.add(j)print(ans)