結果

問題 No.2602 Real Collider
ユーザー mkawa2mkawa2
提出日時 2024-01-12 22:18:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,763 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 96,724 KB
最終ジャッジ日時 2024-01-12 22:18:27
合計ジャッジ時間 12,698 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 124 ms
85,648 KB
testcase_13 WA -
testcase_14 AC 125 ms
86,476 KB
testcase_15 AC 99 ms
81,884 KB
testcase_16 AC 118 ms
84,812 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 114 ms
84,264 KB
testcase_20 AC 142 ms
87,448 KB
testcase_21 AC 104 ms
81,956 KB
testcase_22 AC 121 ms
84,116 KB
testcase_23 AC 106 ms
81,352 KB
testcase_24 AC 121 ms
83,692 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 129 ms
85,088 KB
testcase_28 WA -
testcase_29 AC 114 ms
83,972 KB
testcase_30 AC 116 ms
84,268 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 121 ms
84,816 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 135 ms
85,640 KB
testcase_38 AC 125 ms
85,920 KB
testcase_39 WA -
testcase_40 AC 101 ms
80,656 KB
testcase_41 AC 128 ms
86,888 KB
testcase_42 AC 117 ms
84,272 KB
testcase_43 AC 120 ms
84,676 KB
testcase_44 AC 133 ms
87,032 KB
testcase_45 AC 115 ms
83,008 KB
testcase_46 AC 102 ms
81,952 KB
testcase_47 WA -
testcase_48 AC 117 ms
83,428 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 101 ms
81,344 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 120 ms
83,840 KB
testcase_56 WA -
testcase_57 AC 110 ms
83,152 KB
testcase_58 AC 86 ms
78,852 KB
testcase_59 AC 117 ms
84,284 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 121 ms
85,092 KB
testcase_63 AC 134 ms
86,464 KB
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 120 ms
84,948 KB
testcase_75 WA -
testcase_76 WA -
testcase_77 AC 120 ms
84,676 KB
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 131 ms
86,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = -1-(-1 << 31)
# inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

def isobt(xa,ya,xb,yb,xc,yc):
    vx,vy=xb-xa,yb-ya
    wx,wy=xc-xa,yc-ya
    return vx*wx+vy*wy<=0

q=II()
xa,ya,xb,yb,xc,yc=LI()
xy=LLI(q)

if isobt(xa,ya,xb,yb,xc,yc):
    xo=(xb+xc)/2
    yo=(yb+yc)/2
elif isobt(xb,yb,xa,ya,xc,yc):
    xo=(xa+xc)/2
    yo=(ya+yc)/2
elif isobt(xc,yc,xa,ya,xb,yb):
    xo=(xb+xa)/2
    yo=(yb+ya)/2
else:
    xm=(xa+xb)/2
    ym=(ya+yb)/2
    xn=(xc+xb)/2
    yn=(yc+yb)/2
    vx=ya-yb
    vy=xb-xa
    wx=yb-yc
    wy=xc-xb
    mat=[[vx,-wx,xn-xm],
         [vy,-wy,yn-ym]]
    
    if mat[0][0]==0:
        mat[0],mat[1]=mat[1],mat[0]
    d=mat[0][0]
    mat[0][0]=1
    mat[0][1]/=d
    mat[0][2]/=d
    
    c=mat[1][0]
    mat[1][0]=0
    mat[1][1]-=mat[0][1]*c
    mat[1][2]-=mat[0][2]*c
    
    if mat[1][1]:
        s=mat[1][2]/mat[1][1]
        xo,yo=xn+wx*s,yn+wy*s
    else:
        xo=(xa+xb+xc)/3
        yo=(ya+yb+yc)/3

r2=(xa-xo)**2+(ya-yo)**2

for x,y in xy:
    if (x-xo)**2+(y-yo)**2>r2:
        print("No")
    else:
        print("Yes")
0