結果

問題 No.2602 Real Collider
ユーザー Taiki0715Taiki0715
提出日時 2024-01-12 21:54:33
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 332 ms / 2,000 ms
コード長 6,392 bytes
コンパイル時間 3,983 ms
コンパイル使用メモリ 178,228 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 21:54:51
合計ジャッジ時間 16,916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 332 ms
6,676 KB
testcase_11 AC 120 ms
6,676 KB
testcase_12 AC 161 ms
6,676 KB
testcase_13 AC 78 ms
6,676 KB
testcase_14 AC 175 ms
6,676 KB
testcase_15 AC 92 ms
6,676 KB
testcase_16 AC 145 ms
6,676 KB
testcase_17 AC 157 ms
6,676 KB
testcase_18 AC 114 ms
6,676 KB
testcase_19 AC 137 ms
6,676 KB
testcase_20 AC 184 ms
6,676 KB
testcase_21 AC 107 ms
6,676 KB
testcase_22 AC 129 ms
6,676 KB
testcase_23 AC 84 ms
6,676 KB
testcase_24 AC 125 ms
6,676 KB
testcase_25 AC 134 ms
6,676 KB
testcase_26 AC 96 ms
6,676 KB
testcase_27 AC 149 ms
6,676 KB
testcase_28 AC 156 ms
6,676 KB
testcase_29 AC 124 ms
6,676 KB
testcase_30 AC 136 ms
6,676 KB
testcase_31 AC 146 ms
6,676 KB
testcase_32 AC 122 ms
6,676 KB
testcase_33 AC 144 ms
6,676 KB
testcase_34 AC 148 ms
6,676 KB
testcase_35 AC 90 ms
6,676 KB
testcase_36 AC 91 ms
6,676 KB
testcase_37 AC 159 ms
6,676 KB
testcase_38 AC 170 ms
6,676 KB
testcase_39 AC 163 ms
6,676 KB
testcase_40 AC 76 ms
6,676 KB
testcase_41 AC 176 ms
6,676 KB
testcase_42 AC 139 ms
6,676 KB
testcase_43 AC 143 ms
6,676 KB
testcase_44 AC 184 ms
6,676 KB
testcase_45 AC 113 ms
6,676 KB
testcase_46 AC 109 ms
6,676 KB
testcase_47 AC 162 ms
6,676 KB
testcase_48 AC 124 ms
6,676 KB
testcase_49 AC 106 ms
6,676 KB
testcase_50 AC 81 ms
6,676 KB
testcase_51 AC 85 ms
6,676 KB
testcase_52 AC 60 ms
6,676 KB
testcase_53 AC 146 ms
6,676 KB
testcase_54 AC 114 ms
6,676 KB
testcase_55 AC 132 ms
6,676 KB
testcase_56 AC 122 ms
6,676 KB
testcase_57 AC 117 ms
6,676 KB
testcase_58 AC 44 ms
6,676 KB
testcase_59 AC 141 ms
6,676 KB
testcase_60 AC 128 ms
6,676 KB
testcase_61 AC 96 ms
6,676 KB
testcase_62 AC 146 ms
6,676 KB
testcase_63 AC 171 ms
6,676 KB
testcase_64 AC 197 ms
6,676 KB
testcase_65 AC 96 ms
6,676 KB
testcase_66 AC 156 ms
6,676 KB
testcase_67 AC 72 ms
6,676 KB
testcase_68 AC 83 ms
6,676 KB
testcase_69 AC 60 ms
6,676 KB
testcase_70 AC 72 ms
6,676 KB
testcase_71 AC 93 ms
6,676 KB
testcase_72 AC 141 ms
6,676 KB
testcase_73 AC 121 ms
6,676 KB
testcase_74 AC 144 ms
6,676 KB
testcase_75 AC 152 ms
6,676 KB
testcase_76 AC 134 ms
6,676 KB
testcase_77 AC 142 ms
6,676 KB
testcase_78 AC 172 ms
6,676 KB
testcase_79 AC 149 ms
6,676 KB
testcase_80 AC 177 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
template<int mod>istream &operator>>(istream &is,static_modint<mod> &a){long long b;is>>b;a=b;return is;}
istream &operator>>(istream &is,modint &a){long long b;cin>>b;a=b;return is;}
#endif
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) static_cast<void>(0)
#define debugg(...) static_cast<void>(0)
template<typename T1,typename T2>ostream &operator<<(ostream &os,const pair<T1,T2>&p){os<<p.first<<' '<<p.second;return os;}
#endif
using ll=long long;
using ull=unsigned long long;
using P=pair<ll,ll>;
template<typename T>using minque=priority_queue<T,vector<T>,greater<T>>;
template<typename T>bool chmax(T &a,const T &b){return (a<b?(a=b,true):false);}
template<typename T>bool chmin(T &a,const T &b){return (a>b?(a=b,true):false);}
template<typename T1,typename T2>istream &operator>>(istream &is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}
template<typename T>istream &operator>>(istream &is,vector<T> &a){for(auto &i:a)is>>i;return is;}
template<typename T1,typename T2>void operator++(pair<T1,T2>&a,int n){a.first++,a.second++;}
template<typename T1,typename T2>void operator--(pair<T1,T2>&a,int n){a.first--,a.second--;}
template<typename T>void operator++(vector<T>&a,int n){for(auto &i:a)i++;}
template<typename T>void operator--(vector<T>&a,int n){for(auto &i:a)i--;}
#define reps(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) reps(i,0,n)
#define all(x) x.begin(),x.end()
#define pcnt(x) __builtin_popcountll(x)
ll myceil(ll a,ll b){return (a+b-1)/b;}
template<typename T,size_t n,size_t id=0>
auto vec(const int (&d)[n],const T &init=T()){
  if constexpr (id<n)return vector(d[id],vec<T,n,id+1>(d,init));
  else return init;
}
void SOLVE();
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  #ifdef LOCAL
  clock_t start=clock();
  #endif
  int testcase=1;
  //cin>>testcase;
  for(int i=0;i<testcase;i++){
    SOLVE();
  }
  #ifdef LOCAL
  cerr<<"time:";
  cerr<<(clock()-start)/1000;
  cerr<<"ms\n";
  #endif
}
using R=long double;
constexpr R eps=1e-12;
constexpr R pi=3.141592653589793238;
struct Point{
  R x,y;
  Point(R x,R y):x(x),y(y){}
  Point():x(0),y(0){}
  friend Point operator+(const Point &a,const Point &b){return Point(a.x+b.x,a.y+b.y);}
  friend Point operator-(const Point &a,const Point &b){return Point(a.x-b.x,a.y-b.y);}
  friend Point operator*(const Point &a,const R &r){return Point(a.x*r,a.y*r);}
  friend Point operator/(const Point &a,const R &r){return Point(a.x/r,a.y/r);}
  Point &operator+=(const Point &a){
    *this=*this+a;
    return *this;
  }
  Point &operator-=(const Point &a){
    *this=*this-a;
    return *this;
  }
  Point &operator*=(const R &r){
    *this=*this*r;
    return *this;
  }
  Point &operator/=(const R &r){
    *this=*this/r;
    return *this;
  }
  friend bool operator==(const Point &a,const Point &b){return abs(a.x-b.x)<eps&&abs(a.y-b.y)<eps;}
  friend bool operator!=(const Point &a,const Point &b){return !(a==b);}
  friend istream &operator>>(istream &is,Point &a){
    is>>a.x>>a.y;
    return is;
  }
  friend ostream &operator<<(ostream &os,const Point &a){
    os<<a.x<<' '<<a.y;
    return os;
  }
  R arg()const{return atan2(y,x);}
  Point rot(R theta)const{
    R s=sin(theta),c=cos(theta);
    return Point(c*x-s*y,s*x+c*y);
  }
  R size()const{return sqrt(x*x+y*y);}
};
R dot(const Point &a,const Point &b){return a.x*b.x+a.y*b.y;}
R cross(const Point &a,const Point &b){return a.x*b.y-a.y*b.x;}
R distance(const Point &a,const Point &b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
struct Line{
  Point a,b;
  Line():a(Point(0,0)),b(Point(0,0)){}
  Line(Point a,Point b):a(a),b(b){}
  //Ax+By=C
  Line(R A,R B,R C){
    assert(abs(A)>=eps||abs(B)>=eps);
    if(abs(A)<eps)a=Point(0,C/B),b=Point(1,C/B);
    else if(abs(B)<eps)a=Point(C/A,0),b=Point(C/A,1);
    else a=Point(C/A,0),b=Point(0,C/B);
  }
};
Point projection(const Point &p,const Line &l){
  R t=dot(p-l.a,l.a-l.b)/((l.a.x-l.b.x)*(l.a.x-l.b.x)+(l.a.y-l.b.y)*(l.a.y-l.b.y));
  return l.a+(l.a-l.b)*t;
}
Point reflection(const Point &p,const Line &l){
  return p+(projection(p,l)-p)*2.0;
}
R distance(const Line &l,const Point &a){return (a-projection(a,l)).size();}
Line suityokunitoubunsenn(const Point &a,const Point &b){
  Point c=(a+b)*R(0.5);
  Point d=(a-c).rot(pi/2)+c;
  return Line(c,d);
}
Point crosspoint(const Line &a,const Line &b){
  R c=cross(a.b-a.a,b.b-b.a),d=cross(a.b-a.a,a.b-b.a);
  if(abs(c)<eps&&abs(d)<eps)return b.a;
  return b.a+(b.b-b.a)*d/c;
}
bool ON(const Point &a,const Point &b,const Point &p){
  if(a==p)return true;
  if(b==p)return true;
  if(cross(a-p,b-p)>=eps)return false;
  return dot(a-p,b-p)<0;
}
bool sameline(const Point &a,const Point &b,const Point &c){return abs(cross(b-a,c-a))<eps;}
struct Circle{
  Point p;
  R r;
  Circle():p(Point(0,0)),r(0){}
  Circle(const Point p,R r):p(p),r(r){}
  Circle(const Point &a,const Point &b,const Point &c){
    if(abs(cross(b-a,c-a))<eps){
      r=1e19;
    }
    else{
      Line x=suityokunitoubunsenn(a,b),y=suityokunitoubunsenn(a,c);
      p=crosspoint(x,y);
      r=distance(p,a);
    }
  }
  bool in(const Point &a){return distance(a,p)<=r+eps;}
};
bool iscross(const Circle &a,const Circle &b){
  if((a.p-b.p).size()+eps>a.r+b.r)return false;
  if((a.p-b.p).size()<abs(a.r-b.r)+eps)return false;
  return true;
}
pair<Point,Point>crosspoint(const Circle &c,const Line &l){
  Point pr=projection(c.p,l);
  Point e=(l.b-l.a)/(l.b-l.a).size();
  if(abs(distance(l,c.p)-c.r)<eps)return {pr,pr};
  Point a=pr-c.p;
  double b=sqrt(c.r*c.r-(a.x*a.x+a.y*a.y));
  return {pr-e*b,pr+e*b};
}
pair<Point,Point>crosspoint(const Circle &a,const Circle &b){
  R d=(a.p-b.p).size();
  R e=acos((a.r*a.r+d*d-b.r*b.r)/(2*a.r*d));
  R t=atan2(b.p.y-a.p.y,b.p.x-a.p.x);
  Point p1=a.p+Point(cos(t+e)*a.r,sin(t+e)*a.r);
  Point p2=a.p+Point(cos(t-e)*a.r,sin(t-e)*a.r);
  return make_pair(p1,p2);
}
void SOLVE(){
  int q;
  cin>>q;
  Point a,b,c;
  cin>>a>>b>>c;
  Circle ci(a,b,c);
  if(Circle((a+b)/2,distance(a,b)/2).in(c))ci=Circle((a+b)/2,distance(a,b)/2);
  if(Circle((b+c)/2,distance(b,c)/2).in(a))ci=Circle((b+c)/2,distance(b,c)/2);
  if(Circle((c+a)/2,distance(c,a)/2).in(b))ci=Circle((c+a)/2,distance(c,a)/2);
  while(q--){
    Point p;
    cin>>p;
    cout<<(ci.in(p)?"Yes":"No")<<endl;
  }
}
0