結果
問題 | No.2602 Real Collider |
ユーザー | Misuki |
提出日時 | 2024-01-12 23:45:16 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,229 bytes |
コンパイル時間 | 2,796 ms |
コンパイル使用メモリ | 202,864 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-28 00:25:51 |
合計ジャッジ時間 | 8,692 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 33 ms
6,940 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 24 ms
6,944 KB |
testcase_16 | AC | 38 ms
6,944 KB |
testcase_17 | WA | - |
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 | AC | 24 ms
6,940 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 40 ms
6,944 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 42 ms
6,944 KB |
testcase_38 | AC | 43 ms
6,944 KB |
testcase_39 | AC | 43 ms
6,944 KB |
testcase_40 | WA | - |
testcase_41 | AC | 47 ms
6,940 KB |
testcase_42 | AC | 38 ms
6,944 KB |
testcase_43 | AC | 38 ms
6,944 KB |
testcase_44 | AC | 48 ms
6,940 KB |
testcase_45 | AC | 30 ms
6,940 KB |
testcase_46 | AC | 29 ms
6,944 KB |
testcase_47 | AC | 44 ms
6,940 KB |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 23 ms
6,940 KB |
testcase_52 | AC | 18 ms
6,940 KB |
testcase_53 | WA | - |
testcase_54 | AC | 31 ms
6,940 KB |
testcase_55 | AC | 35 ms
6,940 KB |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | AC | 37 ms
6,944 KB |
testcase_60 | AC | 36 ms
6,940 KB |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 50 ms
6,940 KB |
testcase_64 | AC | 51 ms
6,940 KB |
testcase_65 | WA | - |
testcase_66 | AC | 42 ms
6,940 KB |
testcase_67 | AC | 20 ms
6,944 KB |
testcase_68 | AC | 24 ms
6,940 KB |
testcase_69 | AC | 17 ms
6,940 KB |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | AC | 32 ms
6,940 KB |
testcase_74 | AC | 40 ms
6,944 KB |
testcase_75 | AC | 42 ms
6,940 KB |
testcase_76 | AC | 36 ms
6,940 KB |
testcase_77 | AC | 41 ms
6,944 KB |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | AC | 46 ms
6,944 KB |
ソースコード
#pragma GCC optimize("O2") #include <algorithm> #include <array> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cfenv> #include <cfloat> #include <chrono> #include <cinttypes> #include <climits> #include <cmath> #include <compare> #include <complex> #include <concepts> #include <cstdarg> #include <cstddef> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <initializer_list> #include <iomanip> #include <ios> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <map> #include <memory> #include <new> #include <numbers> #include <numeric> #include <ostream> #include <queue> #include <random> #include <ranges> #include <set> #include <span> #include <sstream> #include <stack> #include <streambuf> #include <string> #include <tuple> #include <type_traits> #include <variant> #define int ll #define INT128_MAX (__int128)(((unsigned __int128) 1 << ((sizeof(__int128) * __CHAR_BIT__) - 1)) - 1) #define INT128_MIN (-INT128_MAX - 1) #ifdef DEBUG #define dbg(x) cout << (#x) << " = " << x << '\n' #else #define dbg(x) #endif namespace R = std::ranges; namespace V = std::views; using namespace std; using ll = long long; using ull = unsigned long long; using ldb = long double; #define double ldb template<class T, size_t N> ostream& operator<<(ostream& os, const array<T, N> &arr) { for(const T &X : arr) os << X << ' '; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T> &vec) { for(const T &X : vec) os << X << ' '; return os; } template<class T> ostream& operator<<(ostream& os, const set<T> &s) { for(const T &x : s) os << x << ' '; return os; } /** * template name: geometryBasic */ template <class T> int sgn(T x) { return (x > 0) - (x < 0); } template<class T> struct Point { typedef Point P; T x, y; explicit Point(T x=0, T y=0) : x(x), y(y) {} bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); } bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); } P operator+(P p) const { return P(x+p.x, y+p.y); } P operator-(P p) const { return P(x-p.x, y-p.y); } P operator*(T d) const { return P(x*d, y*d); } P operator/(T d) const { return P(x/d, y/d); } T dot(P p) const { return x*p.x + y*p.y; } T cross(P p) const { return x*p.y - y*p.x; } T cross(P a, P b) const { return (a-*this).cross(b-*this); } T dist2() const { return x*x + y*y; } double dist() const { return sqrtl((double)dist2()); } // angle to x-axis in interval [-pi, pi] double angle() const { return atan2(y, x); } P unit() const { return *this/dist(); } // makes dist()=1 P perp() const { return P(-y, x); } // rotates +90 degrees P normal() const { return perp().unit(); } // returns point rotated 'a' radians ccw around the origin P rotate(double a) const { return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); } friend ostream& operator<<(ostream& os, P p) { return os << "(" << p.x << "," << p.y << ")"; } }; /** * template name: geometryLine */ template<class P> bool onSegment(P s, P e, P p) { return p.cross(s, e) == 0 && (s - p).dot(e - p) <= 0; } /** * template name: geometry circle */ using P = Point<double>; double ccRadius(const P& A, const P& B, const P& C) { return (B-A).dist()*(C-B).dist()*(A-C).dist()/ abs((B-A).cross(C-A))/2; } P ccCenter(const P& A, const P& B, const P& C) { P b = C-A, c = B-A; return A + (b*c.dist2()-c*b.dist2()).perp()/b.cross(c)/2; } const double eps = 1e-17; signed main() { ios::sync_with_stdio(false), cin.tie(NULL); int q; cin >> q; array<P, 3> pts; for(auto &x : pts) cin >> x.x >> x.y; sort(pts.begin(), pts.end(), [](P l, P r) { return tie(l.x, l.y) < tie(r.x, r.y); }); double r; P center; if (onSegment(pts[0], pts[2], pts[1])) { r = (pts[2] - pts[0]).dist() / 2; center = (pts[2] + pts[0]) / 2; } else { r = ccRadius(pts[0], pts[1], pts[2]); center = ccCenter(pts[0], pts[1], pts[2]); } while(q--) { P pt; cin >> pt.x >> pt.y; if ((center - pt).dist() <= r + eps) cout << "Yes\n"; else cout << "No\n"; } dbg(center); dbg(r); return 0; }