結果
問題 | No.2602 Real Collider |
ユーザー |
|
提出日時 | 2024-01-12 23:06:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,621 bytes |
コンパイル時間 | 4,161 ms |
コンパイル使用メモリ | 252,276 KB |
最終ジャッジ日時 | 2025-02-18 18:58:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 35 WA * 43 |
ソースコード
#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";}}