結果
問題 | No.2602 Real Collider |
ユーザー | umimel |
提出日時 | 2024-01-12 21:57:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,095 bytes |
コンパイル時間 | 1,839 ms |
コンパイル使用メモリ | 173,144 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-27 22:06:18 |
合計ジャッジ時間 | 7,958 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 32 ms
5,376 KB |
testcase_12 | AC | 42 ms
5,376 KB |
testcase_13 | AC | 20 ms
5,376 KB |
testcase_14 | AC | 45 ms
5,376 KB |
testcase_15 | AC | 24 ms
5,376 KB |
testcase_16 | AC | 38 ms
5,376 KB |
testcase_17 | AC | 42 ms
5,376 KB |
testcase_18 | AC | 31 ms
5,376 KB |
testcase_19 | AC | 35 ms
5,376 KB |
testcase_20 | AC | 49 ms
5,376 KB |
testcase_21 | AC | 28 ms
5,376 KB |
testcase_22 | AC | 35 ms
5,376 KB |
testcase_23 | AC | 23 ms
5,376 KB |
testcase_24 | AC | 33 ms
5,376 KB |
testcase_25 | AC | 33 ms
5,376 KB |
testcase_26 | AC | 24 ms
5,376 KB |
testcase_27 | AC | 39 ms
5,376 KB |
testcase_28 | AC | 41 ms
5,376 KB |
testcase_29 | AC | 33 ms
5,376 KB |
testcase_30 | AC | 36 ms
5,376 KB |
testcase_31 | AC | 38 ms
5,376 KB |
testcase_32 | AC | 33 ms
5,376 KB |
testcase_33 | AC | 38 ms
5,376 KB |
testcase_34 | AC | 38 ms
5,376 KB |
testcase_35 | AC | 25 ms
5,376 KB |
testcase_36 | AC | 24 ms
5,376 KB |
testcase_37 | AC | 41 ms
5,376 KB |
testcase_38 | AC | 43 ms
5,376 KB |
testcase_39 | AC | 42 ms
5,376 KB |
testcase_40 | AC | 20 ms
5,376 KB |
testcase_41 | AC | 46 ms
5,376 KB |
testcase_42 | AC | 37 ms
5,376 KB |
testcase_43 | AC | 37 ms
5,376 KB |
testcase_44 | AC | 47 ms
5,376 KB |
testcase_45 | AC | 30 ms
5,376 KB |
testcase_46 | AC | 28 ms
5,376 KB |
testcase_47 | AC | 43 ms
5,376 KB |
testcase_48 | AC | 32 ms
5,376 KB |
testcase_49 | AC | 28 ms
5,376 KB |
testcase_50 | AC | 22 ms
5,376 KB |
testcase_51 | AC | 23 ms
5,376 KB |
testcase_52 | AC | 17 ms
5,376 KB |
testcase_53 | AC | 39 ms
5,376 KB |
testcase_54 | AC | 31 ms
5,376 KB |
testcase_55 | AC | 34 ms
5,376 KB |
testcase_56 | AC | 34 ms
5,376 KB |
testcase_57 | AC | 31 ms
5,376 KB |
testcase_58 | AC | 13 ms
5,376 KB |
testcase_59 | AC | 38 ms
5,376 KB |
testcase_60 | AC | 34 ms
5,376 KB |
testcase_61 | AC | 26 ms
5,376 KB |
testcase_62 | AC | 40 ms
5,376 KB |
testcase_63 | AC | 44 ms
5,376 KB |
testcase_64 | AC | 50 ms
5,376 KB |
testcase_65 | AC | 26 ms
5,376 KB |
testcase_66 | AC | 42 ms
5,376 KB |
testcase_67 | AC | 20 ms
5,376 KB |
testcase_68 | AC | 24 ms
5,376 KB |
testcase_69 | AC | 16 ms
5,376 KB |
testcase_70 | AC | 20 ms
5,376 KB |
testcase_71 | AC | 26 ms
5,376 KB |
testcase_72 | AC | 38 ms
5,376 KB |
testcase_73 | AC | 31 ms
5,376 KB |
testcase_74 | AC | 38 ms
5,376 KB |
testcase_75 | AC | 42 ms
5,376 KB |
testcase_76 | AC | 36 ms
5,376 KB |
testcase_77 | AC | 38 ms
5,376 KB |
testcase_78 | AC | 46 ms
5,376 KB |
testcase_79 | AC | 40 ms
5,376 KB |
testcase_80 | AC | 46 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; /* 幾何ライブラリ */ using DD = double; const DD INF = 1LL<<60; // to be set appropriately const DD EPS = 1e-10; // 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] << '}';} }; // 1:a-bから見てcは左側(反時計回り)、-1:a-bから見てcは右側(時計回り)、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(); }