結果

問題 No.2602 Real Collider
ユーザー cho435cho435
提出日時 2024-01-12 23:07:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,662 bytes
コンパイル時間 4,640 ms
コンパイル使用メモリ 265,220 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 23:08:00
合計ジャッジ時間 10,829 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 1 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 121 ms
6,548 KB
testcase_11 AC 44 ms
6,548 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 32 ms
6,548 KB
testcase_16 AC 50 ms
6,548 KB
testcase_17 AC 56 ms
6,548 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 66 ms
6,548 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 32 ms
6,548 KB
testcase_27 WA -
testcase_28 AC 55 ms
6,548 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 50 ms
6,548 KB
testcase_32 AC 43 ms
6,548 KB
testcase_33 AC 51 ms
6,548 KB
testcase_34 AC 53 ms
6,548 KB
testcase_35 AC 33 ms
6,548 KB
testcase_36 AC 33 ms
6,548 KB
testcase_37 AC 55 ms
6,548 KB
testcase_38 AC 57 ms
6,548 KB
testcase_39 AC 55 ms
6,548 KB
testcase_40 AC 27 ms
6,548 KB
testcase_41 AC 62 ms
6,548 KB
testcase_42 AC 49 ms
6,548 KB
testcase_43 AC 50 ms
6,548 KB
testcase_44 AC 63 ms
6,548 KB
testcase_45 AC 41 ms
6,548 KB
testcase_46 AC 38 ms
6,548 KB
testcase_47 AC 56 ms
6,548 KB
testcase_48 AC 42 ms
6,548 KB
testcase_49 AC 36 ms
6,548 KB
testcase_50 AC 28 ms
6,548 KB
testcase_51 AC 31 ms
6,548 KB
testcase_52 AC 22 ms
6,548 KB
testcase_53 AC 51 ms
6,548 KB
testcase_54 AC 40 ms
6,548 KB
testcase_55 AC 45 ms
6,548 KB
testcase_56 AC 44 ms
6,548 KB
testcase_57 AC 41 ms
6,548 KB
testcase_58 AC 18 ms
6,548 KB
testcase_59 AC 50 ms
6,548 KB
testcase_60 AC 45 ms
6,548 KB
testcase_61 AC 36 ms
6,548 KB
testcase_62 AC 53 ms
6,548 KB
testcase_63 AC 60 ms
6,548 KB
testcase_64 AC 68 ms
6,548 KB
testcase_65 AC 34 ms
6,548 KB
testcase_66 AC 56 ms
6,548 KB
testcase_67 AC 26 ms
6,548 KB
testcase_68 AC 31 ms
6,548 KB
testcase_69 AC 23 ms
6,548 KB
testcase_70 AC 26 ms
6,548 KB
testcase_71 AC 33 ms
6,548 KB
testcase_72 AC 50 ms
6,548 KB
testcase_73 AC 41 ms
6,548 KB
testcase_74 AC 51 ms
6,548 KB
testcase_75 AC 56 ms
6,548 KB
testcase_76 AC 48 ms
6,548 KB
testcase_77 AC 52 ms
6,548 KB
testcase_78 AC 81 ms
6,548 KB
testcase_79 AC 53 ms
6,548 KB
testcase_80 AC 62 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;
using ld = long double;

int main(){
	int q;
	cin>>q;
	vector<pair<int,int>> vp(3);
	vector<pair<int,int>> vq(q);
	for(auto&[x,y]:vp) cin>>x>>y;
	for(auto&[x,y]:vq) cin>>x>>y;
	ld cx,cy,r2=-1;
	rep(i,3){
		int x1,x2,y1,y2;
		x1=vp.at(1).first-vp.at(0).first;
		x2=vp.at(2).first-vp.at(0).first;
		y1=vp.at(1).second-vp.at(0).second;
		y2=vp.at(2).second-vp.at(0).second;
		if(x1*x2+y1*y2<=0){
			cout<<x1*x2+y1*y2<<endl;
			cx=(vp.at(1).first+vp.at(2).first);
			cy=(vp.at(1).second+vp.at(2).second);
			cx/=2;
			cy/=2;
			r2=(vp.at(1).first-vp.at(2).first)*(vp.at(1).first-vp.at(2).first)
					+(vp.at(1).second-vp.at(2).second)*(vp.at(1).second-vp.at(2).second);
			r2/=4;
			break;
		}
		swap(vp.at(0),vp.at(1));
		swap(vp.at(1),vp.at(2));
	}
	ld eps=1e-10;
	if(r2<0){
		ld k=0;
		k+=(vp.at(0).first-vp.at(2).first)*(vp.at(1).first-vp.at(2).first);
		k+=(vp.at(0).second-vp.at(2).second)*(vp.at(1).second-vp.at(2).second);
		ld dv=0;
		dv+=(vp.at(0).first-vp.at(2).first)*(vp.at(1).second-vp.at(2).second);
		dv-=(vp.at(0).second-vp.at(2).second)*(vp.at(1).first-vp.at(2).first);
		assert(abs(dv)>eps);
		k/=dv;
		cx=(vp.at(0).first+vp.at(1).first)+k*(vp.at(0).second-vp.at(1).second);
		cx/=2;
		cy=(vp.at(0).second+vp.at(1).second)-k*(vp.at(0).first-vp.at(1).first);
		cy/=2;
		r2=(vp.at(0).first-cx)*(vp.at(0).first-cx)+(vp.at(0).second-cy)*(vp.at(0).second-cy);
	}
	for(auto[x,y]:vq){
		ld d2=(x-cx)*(x-cx)+(y-cy)*(y-cy);
		if(d2<r2+eps) cout<<"Yes\n";
		else cout<<"No\n";
	}
}
0