結果

問題 No.2602 Real Collider
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-10-25 22:41:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,474 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2023-11-13 17:45:29
合計ジャッジ時間 12,111 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,588 KB
testcase_01 AC 33 ms
53,588 KB
testcase_02 AC 34 ms
53,588 KB
testcase_03 AC 35 ms
53,588 KB
testcase_04 AC 34 ms
53,588 KB
testcase_05 AC 34 ms
53,588 KB
testcase_06 AC 34 ms
53,588 KB
testcase_07 AC 33 ms
53,588 KB
testcase_08 AC 33 ms
53,588 KB
testcase_09 AC 34 ms
53,588 KB
testcase_10 AC 142 ms
76,392 KB
testcase_11 AC 109 ms
76,028 KB
testcase_12 AC 98 ms
75,900 KB
testcase_13 AC 77 ms
75,736 KB
testcase_14 AC 105 ms
75,900 KB
testcase_15 AC 113 ms
76,156 KB
testcase_16 AC 122 ms
76,156 KB
testcase_17 AC 127 ms
76,160 KB
testcase_18 AC 84 ms
75,736 KB
testcase_19 AC 100 ms
75,900 KB
testcase_20 AC 127 ms
76,288 KB
testcase_21 AC 87 ms
75,772 KB
testcase_22 AC 91 ms
75,772 KB
testcase_23 AC 82 ms
75,772 KB
testcase_24 AC 94 ms
75,772 KB
testcase_25 AC 89 ms
75,736 KB
testcase_26 AC 106 ms
76,028 KB
testcase_27 AC 95 ms
75,900 KB
testcase_28 AC 122 ms
76,160 KB
testcase_29 AC 94 ms
75,772 KB
testcase_30 AC 97 ms
75,772 KB
testcase_31 AC 126 ms
76,416 KB
testcase_32 AC 119 ms
76,160 KB
testcase_33 AC 121 ms
76,284 KB
testcase_34 AC 119 ms
76,288 KB
testcase_35 AC 106 ms
76,156 KB
testcase_36 AC 107 ms
76,028 KB
testcase_37 AC 126 ms
76,156 KB
testcase_38 AC 129 ms
76,160 KB
testcase_39 AC 130 ms
76,156 KB
testcase_40 AC 103 ms
76,032 KB
testcase_41 AC 130 ms
76,160 KB
testcase_42 AC 119 ms
76,032 KB
testcase_43 AC 117 ms
76,156 KB
testcase_44 AC 123 ms
76,288 KB
testcase_45 AC 106 ms
76,032 KB
testcase_46 AC 106 ms
76,416 KB
testcase_47 AC 119 ms
76,160 KB
testcase_48 AC 108 ms
76,032 KB
testcase_49 AC 104 ms
76,028 KB
testcase_50 AC 99 ms
76,288 KB
testcase_51 AC 103 ms
76,160 KB
testcase_52 AC 96 ms
76,160 KB
testcase_53 AC 116 ms
76,160 KB
testcase_54 AC 111 ms
76,032 KB
testcase_55 AC 117 ms
76,028 KB
testcase_56 AC 120 ms
76,288 KB
testcase_57 AC 115 ms
76,160 KB
testcase_58 AC 99 ms
76,288 KB
testcase_59 AC 126 ms
76,160 KB
testcase_60 AC 111 ms
76,160 KB
testcase_61 AC 103 ms
76,156 KB
testcase_62 AC 117 ms
76,416 KB
testcase_63 AC 123 ms
76,160 KB
testcase_64 AC 128 ms
76,288 KB
testcase_65 AC 105 ms
76,028 KB
testcase_66 AC 118 ms
76,160 KB
testcase_67 AC 97 ms
76,032 KB
testcase_68 AC 101 ms
76,032 KB
testcase_69 AC 102 ms
76,032 KB
testcase_70 AC 103 ms
76,160 KB
testcase_71 AC 113 ms
76,160 KB
testcase_72 AC 125 ms
76,288 KB
testcase_73 AC 116 ms
76,160 KB
testcase_74 AC 118 ms
76,160 KB
testcase_75 AC 118 ms
76,284 KB
testcase_76 AC 122 ms
76,156 KB
testcase_77 AC 116 ms
76,028 KB
testcase_78 AC 128 ms
76,416 KB
testcase_79 AC 117 ms
76,156 KB
testcase_80 AC 122 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
def read_values(): return tuple(map(int, input().split()))
def read_list(): return list(read_values())

def area(x1,y1,x2,y2,x3,y3):
	return x1*y2+x2*y3+x3*y1-y2*x3-y3*x1-y1*x2

q=int(input())
xa,ya,xb,yb,xc,yc=read_values()
sqa = (xb - xc) * (xb - xc) + (yb - yc) * (yb - yc)
sqb = (xc - xa) * (xc - xa) + (yc - ya) * (yc - ya)
sqc = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)
if sqb>=sqa and sqb>=sqc:
	xa,xb,ya,yb=xb,xa,yb,ya
elif sqc>=sqa and sqc>=sqb:
	xa,xc,ya,yc=xc,xa,yc,ya
sqa = (xb - xc) * (xb - xc) + (yb - yc) * (yb - yc)
sqb = (xc - xa) * (xc - xa) + (yc - ya) * (yc - ya)
sqc = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)

if sqa>=sqb+sqc:
	for _ in range(q):
		xi,yi=read_values()
		bd=(xb - xi) * (xb - xi) + (yb - yi) * (yb - yi);
		cd=(xc - xi) * (xc - xi) + (yc - yi) * (yc - yi);
		if bd+cd<=sqa:
			print('Yes')
		else:
			print('No')
else:
	a1=area(xb,yb,xc,yc,xa,ya)
	num=(xb - xa) * (xc - xa) + (yb - ya) * (yc - ya)
	num*=num
	dem=sqb*sqc
	for _ in range(q):
		xi,yi=read_values()
		bd=(xb - xi) * (xb - xi) + (yb - yi) * (yb - yi);
		cd=(xc - xi) * (xc - xi) + (yc - yi) * (yc - yi);
		inner=(xb - xi) * (xc - xi) + (yb - yi) * (yc - yi)
		numi=inner*inner
		demi=bd*cd
		ai=area(xb,yb,xc,yc,xi,yi)
		if a1*ai>=0:
			if inner < 0 or numi * dem <= num * demi:
				print('Yes')
			else:
				print('No')
		else:
			if inner <= 0 and numi * dem >= num * demi:
				print('Yes')
			else :
				print('No')
				

0