結果

問題 No.2602 Real Collider
ユーザー 👑 timitimi
提出日時 2024-01-13 16:55:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,212 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 17,428 KB
最終ジャッジ日時 2024-01-13 16:55:41
合計ジャッジ時間 5,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 34 ms
10,752 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
ax,ay,bx,by,cx,cy=map(int, input().split())
A=[]
from fractions import Fraction

x=Fraction(bx+cx,2)
y=Fraction(by+cy,2)
r2=(bx-cx)**2+(by-cy)**2
if (ax-x)**2+(ay-y)**2<=Fraction(r2,4):
  A.append((r2,x,y))
ax,ay,bx,by,cx,cy=bx,by,cx,cy,ax,ay
x=Fraction(bx+cx,2)
y=Fraction(by+cy,2)
r2=(bx-cx)**2+(by-cy)**2
if (ax-x)**2+(ay-y)**2<=Fraction(r2,4):
  A.append((r2,x,y))
ax,ay,bx,by,cx,cy=bx,by,cx,cy,ax,ay
x=Fraction(bx+cx,2)
y=Fraction(by+cy,2)
r2=(bx-cx)**2+(by-cy)**2
if (ax-x)**2+(ay-y)**2<=Fraction(r2,4):
  A.append((r2,x,y))
ax,ay,bx,by,cx,cy=bx,by,cx,cy,ax,ay

def c(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d==0:
      return 0,0,-1
    x=Fraction(((y1-y3)*(y1**2-y2**2+x1**2-x2**2)-(y1-y2)*(y1**2-y3**2+x1**2-x3**2)),d)
    y=Fraction(((x1-x3)*(x1**2-x2**2+y1**2-y2**2)-(x1-x2)*(x1**2-x3**2+y1**2-y3**2)),-d)
    r=((x - x1) ** 2 + (y - y1) ** 2)
    return x,y,r

x,y,r=c(ax,ay,bx,by,cx,cy)

if r!=-1:
  A.append((4*r,x,y))
A=sorted(A)
r,x,y=A[0]
for i in range(Q):
  xx,yy=map(int, input().split())
  if ((x-xx)**2+(y-yy)**2)*4>r:
    print('No')
  else:
    print('Yes')
0