結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 3 ms
6,548 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 51 ms
6,548 KB
testcase_17 AC 56 ms
6,548 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 51 ms
6,548 KB
testcase_32 AC 44 ms
6,548 KB
testcase_33 WA -
testcase_34 AC 52 ms
6,548 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 57 ms
6,548 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 63 ms
6,548 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 64 ms
6,548 KB
testcase_45 AC 40 ms
6,548 KB
testcase_46 AC 39 ms
6,548 KB
testcase_47 AC 58 ms
6,548 KB
testcase_48 AC 42 ms
6,548 KB
testcase_49 AC 36 ms
6,548 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 23 ms
6,548 KB
testcase_53 AC 52 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 17 ms
6,548 KB
testcase_59 AC 49 ms
6,548 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 53 ms
6,548 KB
testcase_63 WA -
testcase_64 AC 68 ms
6,548 KB
testcase_65 WA -
testcase_66 AC 56 ms
6,548 KB
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 23 ms
6,548 KB
testcase_70 AC 27 ms
6,548 KB
testcase_71 AC 33 ms
6,548 KB
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 52 ms
6,548 KB
testcase_75 WA -
testcase_76 AC 48 ms
6,548 KB
testcase_77 AC 51 ms
6,548 KB
testcase_78 AC 63 ms
6,548 KB
testcase_79 AC 53 ms
6,548 KB
testcase_80 WA -
権限があれば一括ダウンロードができます

ソースコード

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));
	}
	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);
		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) cout<<"Yes\n";
		else cout<<"No\n";
	}
}
0