結果

問題 No.2602 Real Collider
ユーザー pitPpitP
提出日時 2024-01-12 22:59:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,566 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,248 KB
最終ジャッジ日時 2024-01-12 23:00:34
合計ジャッジ時間 34,192 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 40 ms
55,584 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 936 ms
76,248 KB
testcase_11 AC 391 ms
75,992 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 336 ms
75,864 KB
testcase_16 AC 444 ms
75,992 KB
testcase_17 AC 487 ms
75,992 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 557 ms
75,992 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 320 ms
75,864 KB
testcase_27 WA -
testcase_28 AC 478 ms
75,992 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 446 ms
75,992 KB
testcase_32 AC 413 ms
75,992 KB
testcase_33 AC 446 ms
75,992 KB
testcase_34 AC 449 ms
75,992 KB
testcase_35 AC 320 ms
75,864 KB
testcase_36 AC 299 ms
75,864 KB
testcase_37 AC 470 ms
75,992 KB
testcase_38 AC 520 ms
75,992 KB
testcase_39 AC 471 ms
75,992 KB
testcase_40 AC 273 ms
75,864 KB
testcase_41 AC 544 ms
75,992 KB
testcase_42 AC 423 ms
75,992 KB
testcase_43 AC 460 ms
75,992 KB
testcase_44 AC 537 ms
75,992 KB
testcase_45 AC 361 ms
75,992 KB
testcase_46 AC 374 ms
75,864 KB
testcase_47 AC 488 ms
75,992 KB
testcase_48 AC 398 ms
75,864 KB
testcase_49 AC 343 ms
75,864 KB
testcase_50 AC 285 ms
75,864 KB
testcase_51 AC 298 ms
75,864 KB
testcase_52 AC 253 ms
75,864 KB
testcase_53 AC 444 ms
75,992 KB
testcase_54 AC 363 ms
75,864 KB
testcase_55 AC 424 ms
75,992 KB
testcase_56 AC 395 ms
75,992 KB
testcase_57 AC 380 ms
75,864 KB
testcase_58 AC 200 ms
75,992 KB
testcase_59 AC 459 ms
75,992 KB
testcase_60 AC 403 ms
75,992 KB
testcase_61 AC 326 ms
75,864 KB
testcase_62 AC 463 ms
75,992 KB
testcase_63 AC 510 ms
75,992 KB
testcase_64 AC 596 ms
75,992 KB
testcase_65 AC 327 ms
75,864 KB
testcase_66 AC 488 ms
75,992 KB
testcase_67 AC 269 ms
75,864 KB
testcase_68 AC 296 ms
75,992 KB
testcase_69 AC 236 ms
75,992 KB
testcase_70 AC 261 ms
75,864 KB
testcase_71 AC 334 ms
75,864 KB
testcase_72 AC 438 ms
75,992 KB
testcase_73 AC 373 ms
75,864 KB
testcase_74 AC 476 ms
75,992 KB
testcase_75 AC 476 ms
75,992 KB
testcase_76 AC 446 ms
75,992 KB
testcase_77 AC 436 ms
75,992 KB
testcase_78 AC 523 ms
75,992 KB
testcase_79 AC 472 ms
75,992 KB
testcase_80 AC 527 ms
75,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# https://qiita.com/tatesuke/items/59133758ec25146766c3
Q = int(input())
a, b, c, d, e, f = map(int, input().split())


if (c - a) * (f - b) - (d - b) * (e - a) == 0:
    xy = [[a, b], [c, d], [e, f]]
    xy.sort()

    XM = xy[-1][0]
    xm = xy[0][0]
    px_nume = XM + xm
    px_deno = 2

    YM = xy[-1][1]
    ym = xy[0][1]
    py_nume = YM + ym
    py_deno = 2

    r2 = (py_deno ** 2) * ((px_nume - XM * px_deno) ** 2) + (px_deno ** 2) * ((py_nume - YM * py_deno) ** 2)
    for _ in range(Q):
        x, y = map(int, input().split())
        R2 = py_deno ** 2 * (px_nume - x * px_deno) ** 2 + px_deno ** 2 * (py_nume - y * py_deno) ** 2

        if R2 > r2:
            print("No")
        else:
            print("Yes")
else:
    aa = a * a
    bb = b * b
    cc = c * c
    dd = d * d
    ee = e * e
    ff = f * f

    py_nume = (e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)
    py_deno = 2 * (e - a)*(b - d) - 2 * (c - a) * (b - f)

    if c == a:
        px_nume = 2 * (b - f) * py_nume - (aa + bb - ee - ff) * py_deno
        px_deno = 2 * (e - a) * py_deno
    else:
        px_nume = 2 * (b - d) * py_nume - (aa + bb - cc - dd) * py_deno
        px_deno = 2 * (c - a) * py_deno

    r2 = (py_deno ** 2) * ((px_nume - a * px_deno) ** 2) + (px_deno ** 2) * ((py_nume - b * py_deno) ** 2)
    for _ in range(Q):
        x, y = map(int, input().split())
        R2 = py_deno ** 2 * (px_nume - x * px_deno) ** 2 + px_deno ** 2 * (py_nume - y * py_deno) ** 2

        if R2 > r2:
            print("No")
        else:
            print("Yes")
0