結果

問題 No.2602 Real Collider
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-10-30 23:31:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 589 ms / 2,000 ms
コード長 1,207 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 93,576 KB
最終ジャッジ日時 2023-11-13 17:46:40
合計ジャッジ時間 32,818 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
87,688 KB
testcase_01 AC 158 ms
87,688 KB
testcase_02 AC 133 ms
87,688 KB
testcase_03 AC 139 ms
87,688 KB
testcase_04 AC 131 ms
87,688 KB
testcase_05 AC 132 ms
87,688 KB
testcase_06 AC 133 ms
87,688 KB
testcase_07 AC 131 ms
87,688 KB
testcase_08 AC 131 ms
87,688 KB
testcase_09 AC 157 ms
87,688 KB
testcase_10 AC 589 ms
93,576 KB
testcase_11 AC 388 ms
90,760 KB
testcase_12 AC 355 ms
91,144 KB
testcase_13 AC 270 ms
90,376 KB
testcase_14 AC 346 ms
91,272 KB
testcase_15 AC 379 ms
90,376 KB
testcase_16 AC 443 ms
90,968 KB
testcase_17 AC 449 ms
91,144 KB
testcase_18 AC 286 ms
90,632 KB
testcase_19 AC 326 ms
91,016 KB
testcase_20 AC 501 ms
91,284 KB
testcase_21 AC 287 ms
90,632 KB
testcase_22 AC 307 ms
90,888 KB
testcase_23 AC 277 ms
90,504 KB
testcase_24 AC 303 ms
90,888 KB
testcase_25 AC 298 ms
90,760 KB
testcase_26 AC 331 ms
90,248 KB
testcase_27 AC 322 ms
91,144 KB
testcase_28 AC 386 ms
91,272 KB
testcase_29 AC 310 ms
90,888 KB
testcase_30 AC 329 ms
91,016 KB
testcase_31 AC 435 ms
90,888 KB
testcase_32 AC 394 ms
90,760 KB
testcase_33 AC 421 ms
90,888 KB
testcase_34 AC 438 ms
90,904 KB
testcase_35 AC 345 ms
90,248 KB
testcase_36 AC 322 ms
90,504 KB
testcase_37 AC 437 ms
91,016 KB
testcase_38 AC 449 ms
91,400 KB
testcase_39 AC 439 ms
91,016 KB
testcase_40 AC 337 ms
90,120 KB
testcase_41 AC 474 ms
91,400 KB
testcase_42 AC 415 ms
90,888 KB
testcase_43 AC 407 ms
90,888 KB
testcase_44 AC 481 ms
91,528 KB
testcase_45 AC 396 ms
90,504 KB
testcase_46 AC 364 ms
90,376 KB
testcase_47 AC 441 ms
91,016 KB
testcase_48 AC 392 ms
90,760 KB
testcase_49 AC 379 ms
90,376 KB
testcase_50 AC 351 ms
90,136 KB
testcase_51 AC 346 ms
90,248 KB
testcase_52 AC 311 ms
89,864 KB
testcase_53 AC 429 ms
91,016 KB
testcase_54 AC 393 ms
90,504 KB
testcase_55 AC 419 ms
90,632 KB
testcase_56 AC 409 ms
90,648 KB
testcase_57 AC 386 ms
90,632 KB
testcase_58 AC 299 ms
89,608 KB
testcase_59 AC 407 ms
90,888 KB
testcase_60 AC 382 ms
90,888 KB
testcase_61 AC 375 ms
90,248 KB
testcase_62 AC 445 ms
90,900 KB
testcase_63 AC 446 ms
91,272 KB
testcase_64 AC 519 ms
91,272 KB
testcase_65 AC 355 ms
90,504 KB
testcase_66 AC 465 ms
91,016 KB
testcase_67 AC 333 ms
89,864 KB
testcase_68 AC 343 ms
90,120 KB
testcase_69 AC 317 ms
89,992 KB
testcase_70 AC 327 ms
90,120 KB
testcase_71 AC 354 ms
90,248 KB
testcase_72 AC 439 ms
91,016 KB
testcase_73 AC 385 ms
90,632 KB
testcase_74 AC 425 ms
90,888 KB
testcase_75 AC 465 ms
91,144 KB
testcase_76 AC 417 ms
90,632 KB
testcase_77 AC 421 ms
90,760 KB
testcase_78 AC 490 ms
91,272 KB
testcase_79 AC 452 ms
91,028 KB
testcase_80 AC 472 ms
91,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from fractions import Fraction
input = sys.stdin.readline
def read_values(): return tuple(map(int, input().split()))

def main():  
    q=int(input())
    xa,ya,xb,yb,xc,yc=read_values()
    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=read_values()
        rr2=(ox-x)*(ox-x)+(oy-y)*(oy-y)
        if rr2<=r2:
            print('Yes')
        else:
            print('No')

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