結果

問題 No.2602 Real Collider
ユーザー 👑 timitimi
提出日時 2024-01-13 16:57:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,529 ms / 2,000 ms
コード長 1,212 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 90,768 KB
最終ジャッジ日時 2024-01-13 16:58:04
合計ジャッジ時間 58,239 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
87,696 KB
testcase_01 AC 131 ms
87,696 KB
testcase_02 AC 142 ms
87,696 KB
testcase_03 AC 136 ms
87,696 KB
testcase_04 AC 129 ms
87,696 KB
testcase_05 AC 130 ms
87,696 KB
testcase_06 AC 140 ms
87,696 KB
testcase_07 AC 135 ms
87,696 KB
testcase_08 AC 135 ms
87,696 KB
testcase_09 AC 133 ms
87,696 KB
testcase_10 AC 1,529 ms
90,768 KB
testcase_11 AC 745 ms
90,128 KB
testcase_12 AC 538 ms
89,488 KB
testcase_13 AC 387 ms
89,488 KB
testcase_14 AC 598 ms
90,000 KB
testcase_15 AC 632 ms
89,872 KB
testcase_16 AC 834 ms
89,616 KB
testcase_17 AC 927 ms
90,384 KB
testcase_18 AC 433 ms
89,488 KB
testcase_19 AC 548 ms
89,744 KB
testcase_20 AC 891 ms
89,872 KB
testcase_21 AC 473 ms
90,000 KB
testcase_22 AC 474 ms
89,488 KB
testcase_23 AC 419 ms
89,488 KB
testcase_24 AC 501 ms
90,000 KB
testcase_25 AC 495 ms
89,872 KB
testcase_26 AC 502 ms
89,488 KB
testcase_27 AC 549 ms
90,000 KB
testcase_28 AC 682 ms
89,488 KB
testcase_29 AC 541 ms
90,000 KB
testcase_30 AC 567 ms
89,744 KB
testcase_31 AC 822 ms
90,256 KB
testcase_32 AC 784 ms
90,256 KB
testcase_33 AC 836 ms
90,256 KB
testcase_34 AC 875 ms
89,872 KB
testcase_35 AC 639 ms
90,128 KB
testcase_36 AC 521 ms
89,488 KB
testcase_37 AC 903 ms
90,384 KB
testcase_38 AC 913 ms
90,000 KB
testcase_39 AC 915 ms
90,256 KB
testcase_40 AC 564 ms
89,744 KB
testcase_41 AC 984 ms
90,256 KB
testcase_42 AC 839 ms
89,744 KB
testcase_43 AC 739 ms
89,488 KB
testcase_44 AC 1,016 ms
90,128 KB
testcase_45 AC 702 ms
89,616 KB
testcase_46 AC 710 ms
89,744 KB
testcase_47 AC 900 ms
90,384 KB
testcase_48 AC 739 ms
90,128 KB
testcase_49 AC 700 ms
90,384 KB
testcase_50 AC 573 ms
89,616 KB
testcase_51 AC 595 ms
89,744 KB
testcase_52 AC 483 ms
89,488 KB
testcase_53 AC 868 ms
90,512 KB
testcase_54 AC 714 ms
89,488 KB
testcase_55 AC 794 ms
90,128 KB
testcase_56 AC 764 ms
90,128 KB
testcase_57 AC 753 ms
89,872 KB
testcase_58 AC 436 ms
89,616 KB
testcase_59 AC 812 ms
90,000 KB
testcase_60 AC 663 ms
90,384 KB
testcase_61 AC 643 ms
89,744 KB
testcase_62 AC 849 ms
89,872 KB
testcase_63 AC 918 ms
89,616 KB
testcase_64 AC 1,066 ms
90,128 KB
testcase_65 AC 649 ms
90,128 KB
testcase_66 AC 920 ms
90,000 KB
testcase_67 AC 555 ms
89,488 KB
testcase_68 AC 595 ms
89,488 KB
testcase_69 AC 479 ms
89,744 KB
testcase_70 AC 547 ms
89,488 KB
testcase_71 AC 635 ms
89,744 KB
testcase_72 AC 837 ms
89,744 KB
testcase_73 AC 720 ms
90,384 KB
testcase_74 AC 860 ms
90,256 KB
testcase_75 AC 927 ms
90,384 KB
testcase_76 AC 833 ms
90,000 KB
testcase_77 AC 826 ms
90,000 KB
testcase_78 AC 1,000 ms
90,000 KB
testcase_79 AC 885 ms
89,616 KB
testcase_80 AC 950 ms
89,616 KB
権限があれば一括ダウンロードができます

ソースコード

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