結果

問題 No.2602 Real Collider
ユーザー anonymouslyanonymously
提出日時 2024-01-13 06:49:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,278 ms / 2,000 ms
コード長 1,403 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-01-13 06:50:10
合計ジャッジ時間 38,753 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 28 ms
9,984 KB
testcase_02 AC 28 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 30 ms
9,984 KB
testcase_05 AC 28 ms
9,984 KB
testcase_06 AC 28 ms
9,984 KB
testcase_07 AC 29 ms
9,984 KB
testcase_08 AC 29 ms
9,984 KB
testcase_09 AC 28 ms
9,984 KB
testcase_10 AC 1,278 ms
9,984 KB
testcase_11 AC 457 ms
9,984 KB
testcase_12 AC 588 ms
9,984 KB
testcase_13 AC 284 ms
9,984 KB
testcase_14 AC 609 ms
9,984 KB
testcase_15 AC 374 ms
9,984 KB
testcase_16 AC 533 ms
9,984 KB
testcase_17 AC 610 ms
9,984 KB
testcase_18 AC 406 ms
9,984 KB
testcase_19 AC 490 ms
9,984 KB
testcase_20 AC 707 ms
9,984 KB
testcase_21 AC 392 ms
9,984 KB
testcase_22 AC 492 ms
9,984 KB
testcase_23 AC 338 ms
9,984 KB
testcase_24 AC 440 ms
9,984 KB
testcase_25 AC 495 ms
9,984 KB
testcase_26 AC 349 ms
9,984 KB
testcase_27 AC 526 ms
9,984 KB
testcase_28 AC 587 ms
9,984 KB
testcase_29 AC 469 ms
9,984 KB
testcase_30 AC 512 ms
9,984 KB
testcase_31 AC 527 ms
9,984 KB
testcase_32 AC 459 ms
9,984 KB
testcase_33 AC 554 ms
9,984 KB
testcase_34 AC 538 ms
9,984 KB
testcase_35 AC 364 ms
9,984 KB
testcase_36 AC 337 ms
9,984 KB
testcase_37 AC 575 ms
9,984 KB
testcase_38 AC 616 ms
9,984 KB
testcase_39 AC 570 ms
9,984 KB
testcase_40 AC 317 ms
9,984 KB
testcase_41 AC 643 ms
9,984 KB
testcase_42 AC 532 ms
9,984 KB
testcase_43 AC 517 ms
9,984 KB
testcase_44 AC 675 ms
9,984 KB
testcase_45 AC 423 ms
9,984 KB
testcase_46 AC 401 ms
9,984 KB
testcase_47 AC 617 ms
9,984 KB
testcase_48 AC 447 ms
9,984 KB
testcase_49 AC 389 ms
9,984 KB
testcase_50 AC 343 ms
9,984 KB
testcase_51 AC 321 ms
9,984 KB
testcase_52 AC 231 ms
9,984 KB
testcase_53 AC 562 ms
9,984 KB
testcase_54 AC 419 ms
9,984 KB
testcase_55 AC 467 ms
9,984 KB
testcase_56 AC 484 ms
9,984 KB
testcase_57 AC 436 ms
9,984 KB
testcase_58 AC 180 ms
9,984 KB
testcase_59 AC 539 ms
9,984 KB
testcase_60 AC 465 ms
9,984 KB
testcase_61 AC 368 ms
9,984 KB
testcase_62 AC 593 ms
9,984 KB
testcase_63 AC 619 ms
9,984 KB
testcase_64 AC 728 ms
9,984 KB
testcase_65 AC 367 ms
9,984 KB
testcase_66 AC 605 ms
9,984 KB
testcase_67 AC 289 ms
9,984 KB
testcase_68 AC 329 ms
9,984 KB
testcase_69 AC 242 ms
9,984 KB
testcase_70 AC 294 ms
9,984 KB
testcase_71 AC 357 ms
9,984 KB
testcase_72 AC 524 ms
9,984 KB
testcase_73 AC 453 ms
9,984 KB
testcase_74 AC 535 ms
9,984 KB
testcase_75 AC 591 ms
9,984 KB
testcase_76 AC 496 ms
9,984 KB
testcase_77 AC 523 ms
9,984 KB
testcase_78 AC 675 ms
9,984 KB
testcase_79 AC 551 ms
9,984 KB
testcase_80 AC 665 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
Xa,Ya,Xb,Yb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Y0)**2 if inA>=0 else (det*Xb-X0)**2+(det*Yb-Y0)**2

for i in range(Q):
    x,y=map(int,input().split())
    if (det*x-X0)**2+(det*y-Y0)**2>R2:
        #print((det*x-X0)**2+(det*y-Y0)**2,"No")
        print("No")
    else:
        #print((det*x-X0)**2+(det*y-Y0)**2,"Yes")
        print("Yes")
0