結果

問題 No.2602 Real Collider
ユーザー るこーそーるこーそー
提出日時 2025-01-01 02:46:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 4,030 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 81,976 KB
実行使用メモリ 80,496 KB
最終ジャッジ日時 2025-01-01 02:47:41
合計ジャッジ時間 77,976 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,312 KB
testcase_01 AC 38 ms
53,684 KB
testcase_02 AC 38 ms
54,632 KB
testcase_03 AC 51 ms
64,232 KB
testcase_04 AC 40 ms
58,880 KB
testcase_05 AC 38 ms
53,424 KB
testcase_06 AC 38 ms
54,228 KB
testcase_07 AC 38 ms
53,564 KB
testcase_08 AC 37 ms
53,200 KB
testcase_09 AC 39 ms
58,532 KB
testcase_10 TLE -
testcase_11 AC 1,014 ms
77,940 KB
testcase_12 AC 576 ms
77,336 KB
testcase_13 AC 383 ms
76,952 KB
testcase_14 AC 631 ms
77,668 KB
testcase_15 AC 856 ms
77,840 KB
testcase_16 AC 1,214 ms
79,636 KB
testcase_17 AC 1,313 ms
79,540 KB
testcase_18 AC 457 ms
77,476 KB
testcase_19 AC 556 ms
77,404 KB
testcase_20 AC 1,295 ms
78,904 KB
testcase_21 AC 478 ms
77,584 KB
testcase_22 AC 510 ms
76,812 KB
testcase_23 AC 419 ms
76,996 KB
testcase_24 AC 490 ms
77,328 KB
testcase_25 AC 512 ms
77,336 KB
testcase_26 AC 681 ms
77,708 KB
testcase_27 AC 552 ms
77,156 KB
testcase_28 AC 1,017 ms
77,816 KB
testcase_29 AC 533 ms
77,464 KB
testcase_30 AC 528 ms
77,320 KB
testcase_31 AC 1,277 ms
78,372 KB
testcase_32 AC 1,102 ms
79,264 KB
testcase_33 AC 1,298 ms
77,972 KB
testcase_34 AC 1,143 ms
78,992 KB
testcase_35 AC 841 ms
77,488 KB
testcase_36 AC 634 ms
77,852 KB
testcase_37 AC 1,367 ms
78,104 KB
testcase_38 AC 1,367 ms
79,592 KB
testcase_39 AC 1,313 ms
78,072 KB
testcase_40 AC 711 ms
78,420 KB
testcase_41 AC 1,434 ms
79,948 KB
testcase_42 AC 1,135 ms
79,152 KB
testcase_43 AC 1,023 ms
78,264 KB
testcase_44 AC 1,476 ms
79,968 KB
testcase_45 AC 949 ms
80,416 KB
testcase_46 AC 945 ms
78,332 KB
testcase_47 AC 1,318 ms
78,372 KB
testcase_48 AC 1,048 ms
79,072 KB
testcase_49 AC 933 ms
77,964 KB
testcase_50 AC 726 ms
78,804 KB
testcase_51 AC 783 ms
78,620 KB
testcase_52 AC 589 ms
78,632 KB
testcase_53 AC 1,268 ms
78,108 KB
testcase_54 AC 945 ms
78,424 KB
testcase_55 AC 1,050 ms
79,240 KB
testcase_56 AC 1,016 ms
78,592 KB
testcase_57 AC 961 ms
79,004 KB
testcase_58 AC 520 ms
79,200 KB
testcase_59 AC 1,225 ms
78,788 KB
testcase_60 AC 863 ms
78,832 KB
testcase_61 AC 848 ms
80,496 KB
testcase_62 AC 1,212 ms
78,852 KB
testcase_63 AC 1,262 ms
80,332 KB
testcase_64 AC 1,582 ms
79,340 KB
testcase_65 AC 853 ms
80,224 KB
testcase_66 AC 1,301 ms
78,804 KB
testcase_67 AC 693 ms
78,816 KB
testcase_68 AC 772 ms
79,504 KB
testcase_69 AC 581 ms
78,176 KB
testcase_70 AC 709 ms
79,508 KB
testcase_71 AC 863 ms
78,668 KB
testcase_72 AC 1,149 ms
80,124 KB
testcase_73 AC 1,017 ms
78,640 KB
testcase_74 AC 1,252 ms
77,984 KB
testcase_75 AC 1,298 ms
79,396 KB
testcase_76 AC 1,121 ms
78,396 KB
testcase_77 AC 1,143 ms
79,672 KB
testcase_78 AC 1,431 ms
79,192 KB
testcase_79 AC 1,200 ms
78,792 KB
testcase_80 AC 1,291 ms
79,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Fraction:
    def __init__(self,numerator,denominator=1):
        if isinstance(numerator,Fraction):
            self.numerator=numerator.numerator
            self.denominator=numerator.denominator
        else:
            if isinstance(numerator,str):
                integer,decimal=numerator.split('.')
                numerator=int(integer)*pow(10,len(decimal))+int(decimal)
                denominator=pow(10,len(decimal))
            self.numerator=numerator
            self.denominator=denominator
            self._reduction()
    def _gcd(self,a,b):
        while b:
            a,b=b,a%b
        return a
    def _reduction(self):
       gcd=self._gcd(self.numerator,self.denominator)
       self.numerator//=gcd
       self.denominator//=gcd
       if self.denominator<0:
           self.numerator*=-1
           self.denominator*=-1
    def __add__(self,other):
        other=Fraction(other)
        numerator=self.numerator*other.denominator + other.numerator*self.denominator
        denominator=self.denominator*other.denominator
        return Fraction(numerator,denominator)
    def __sub__(self,other):
        other=Fraction(other)
        return self+(-other)
    def __mul__(self,other):
        other=Fraction(other)
        numerator=self.numerator*other.numerator
        denominator=self.denominator*other.denominator
        return Fraction(numerator,denominator)
    def __truediv__(self,other):
        other=Fraction(other)
        numerator=self.numerator*other.denominator
        denominator=self.denominator*other.numerator
        return Fraction(numerator,denominator)
    def __radd__(self,other):
        return self+other
    def __rsub__(self,other):
        return self-other
    def __rmul__(self,other):
        return self*other
    def __rfloordiv__(self,other):
        return self/other
    def __iadd__(self,other):
        self=self+other
        return self
    def __isub__(self,other):
        self=self-other
        return self
    def __imul__(self,other):
        self=self*other
        return self
    def __ifloordiv__(self,other):
        self=self/other
        return self
    def __lt__(self,other):
        other=Fraction(other)
        return self.numerator*other.denominator < other.numerator*self.denominator
    def __gt__(self,other):
        other=Fraction(other)
        return self.numerator*other.denominator > other.numerator*self.denominator
    def __le__(self,other):
        return not(self>other)
    def __ge__(self,other):
        return not(self<other)     
    def __neg__(self):
        return Fraction(-self.numerator,self.denominator)
    def __pos__(self):
        return Fraction(self.numerator,self.denominator)
    def __float__(self):
        return self.numerator/self.denominator
    def __int__(self):
        return self.numerator//self.denominator
    def __repr__(self):
        return f"{self.numerator}/{self.denominator}"

def main():  
    q=int(input())
    xa,ya,xb,yb,xc,yc=map(int,input().split())
    ab2=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)
    bc2=(xb-xc)*(xb-xc)+(yb-yc)*(yb-yc)
    ca2=(xc-xa)*(xc-xa)+(yc-ya)*(yc-ya)
    if ab2>=bc2+ca2:
        ox=Fraction(xa+xb,2)
        oy=Fraction(ya+yb,2)
        r2=(ox-xa)*(ox-xa)+(oy-ya)*(oy-ya)
    elif bc2>=ab2+ca2:
        ox=Fraction(xc+xb,2)
        oy=Fraction(yc+yb,2)
        r2=(ox-xc)*(ox-xc)+(oy-yc)*(oy-yc)
    elif ca2>=ab2+bc2:
        ox=Fraction(xc+xa,2)
        oy=Fraction(yc+ya,2)
        r2=(ox-xa)*(ox-xa)+(oy-ya)*(oy-ya)
    else:
        ox=Fraction((xa*xa+ya*ya)*(yb-yc)+(xb*xb+yb*yb)*(yc-ya)+(xc*xc+yc*yc)*(ya-yb),((yb-yc)*(xa-xb)-(ya-yb)*(xb-xc))*2)
        oy=Fraction((xa*xa+ya*ya)*(xb-xc)+(xb*xb+yb*yb)*(xc-xa)+(xc*xc+yc*yc)*(xa-xb),((xb-xc)*(ya-yb)-(xa-xb)*(yb-yc))*2)
        r2=(ox-xa)*(ox-xa)+(oy-ya)*(oy-ya)
    for _ in range(q):
        x,y=map(int,input().split())
        rr2=(ox-x)*(ox-x)+(oy-y)*(oy-y)
        if rr2<=r2:
            print('Yes')
        else:
            print('No')

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