結果

問題 No.2602 Real Collider
ユーザー umimel
提出日時 2024-01-12 22:04:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 4,095 bytes
コンパイル時間 1,870 ms
コンパイル使用メモリ 174,056 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-27 22:21:01
合計ジャッジ時間 8,089 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 75 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
/* */
using DD = double;
const DD INF = 1LL<<60; // to be set appropriately
const DD EPS = 1e-40; // to be set appropriately
const DD PI = acosl(-1.0);
DD torad(int deg) {return (DD)(deg) * PI / 180;}
DD todeg(DD ang) {return ang * 180 / PI;}
/* Point */
struct Point {
DD x, y;
Point(DD x = 0.0, DD y = 0.0) : x(x), y(y) {}
friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};
inline Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
inline Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
inline Point operator * (const Point &p, DD a) {return Point(p.x * a, p.y * a);}
inline Point operator * (DD a, const Point &p) {return Point(a * p.x, a * p.y);}
inline Point operator * (const Point &p, const Point &q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
inline Point operator / (const Point &p, DD a) {return Point(p.x / a, p.y / a);}
inline Point conj(const Point &p) {return Point(p.x, -p.y);}
inline Point rot(const Point &p, DD ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
inline Point rot90(const Point &p) {return Point(-p.y, p.x);}
inline DD cross(const Point &p, const Point &q) {return p.x * q.y - p.y * q.x;}
inline DD dot(const Point &p, const Point &q) {return p.x * q.x + p.y * q.y;}
inline DD norm(const Point &p) {return dot(p, p);}
inline DD abs(const Point &p) {return sqrt(dot(p, p));}
inline DD amp(const Point &p) {DD res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;}
inline bool eq(const Point &p, const Point &q) {return abs(p - q) < EPS;}
inline bool operator < (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x < q.x : p.y < q.y);}
inline bool operator > (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x > q.x : p.y > q.y);}
inline Point operator / (const Point &p, const Point &q) {return p * conj(q) / norm(q);}
/* Line */
struct Line : vector<Point> {
Line(Point a = Point(0.0, 0.0), Point b = Point(0.0, 0.0)) {
this->push_back(a);
this->push_back(b);
}
friend ostream& operator << (ostream &s, const Line &l) {return s << '{' << l[0] << ", " << l[1] << '}';}
};
// 1a-bc()-1a-bc()0
int simple_ccw(const Point &a, const Point &b, const Point &c) {
if (cross(b-a, c-a) > EPS) return 1;
if (cross(b-a, c-a) < -EPS) return -1;
return 0;
}
//
vector<Point> crosspoint(const Line &l, const Line &m) {
vector<Point> res;
DD d = cross(m[1] - m[0], l[1] - l[0]);
if (abs(d) < EPS) return vector<Point>();
res.push_back(l[0] + (l[1] - l[0]) * cross(m[1] - m[0], m[1] - l[0]) / d);
return res;
}
//
Point gaisin(Point a, Point b, Point c) {
Line ab((a+b)/2, (a+b)/2 + rot90(a-b));
Line bc((b+c)/2, (b+c)/2 + rot90(b-c));
return crosspoint(ab, bc)[0];
}
void solve(){
int Q; cin >> Q;
vector<Point> v(3);
for(int i=0; i<3; i++) cin >> v[i].x >> v[i].y;
//
vector<Point> alt;
for (int i = 0; i < 3; ++i) {
for (int j = i+1; j < 3; ++j) {
alt.push_back( (v[i] + v[j]) / 2 );
for (int k = j+1; k < 3; ++k) {
if (simple_ccw(v[i], v[j], v[k]) == 0) continue;
auto r = gaisin(v[i], v[j], v[k]);
alt.push_back(r);
}
}
}
DD res = INF;
Point c;
for (auto r : alt) {
DD tmp = 0;
for (auto p : v) tmp = max(tmp, abs(p - r));
if(res > tmp){
c = r;
res = tmp;
}
}
while(Q--){
Point q; cin >> q.x >> q.y;
if(abs(q-c)-res < EPS) cout << "Yes\n";
else cout << "No\n";
}
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int T=1;
//cin >> T;
while(T--) solve();
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0