結果

問題 No.2602 Real Collider
ユーザー Astral__Astral__
提出日時 2024-01-12 22:03:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 10,171 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 210,524 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-27 22:17:51
合計ジャッジ時間 7,449 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 19 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 35 ms
5,376 KB
testcase_17 AC 37 ms
5,376 KB
testcase_18 AC 27 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 31 ms
5,376 KB
testcase_26 AC 22 ms
5,376 KB
testcase_27 WA -
testcase_28 AC 38 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 35 ms
5,376 KB
testcase_32 AC 30 ms
5,376 KB
testcase_33 WA -
testcase_34 AC 37 ms
5,376 KB
testcase_35 AC 23 ms
5,376 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 19 ms
6,940 KB
testcase_41 WA -
testcase_42 AC 34 ms
6,940 KB
testcase_43 AC 35 ms
6,940 KB
testcase_44 AC 43 ms
6,940 KB
testcase_45 AC 27 ms
6,940 KB
testcase_46 AC 27 ms
6,940 KB
testcase_47 WA -
testcase_48 AC 30 ms
6,940 KB
testcase_49 WA -
testcase_50 AC 21 ms
6,944 KB
testcase_51 WA -
testcase_52 AC 16 ms
6,940 KB
testcase_53 AC 36 ms
6,944 KB
testcase_54 AC 28 ms
6,940 KB
testcase_55 AC 32 ms
6,944 KB
testcase_56 AC 32 ms
6,948 KB
testcase_57 AC 30 ms
6,944 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 25 ms
6,944 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 47 ms
6,940 KB
testcase_65 AC 26 ms
6,940 KB
testcase_66 WA -
testcase_67 AC 20 ms
6,944 KB
testcase_68 AC 23 ms
6,940 KB
testcase_69 AC 17 ms
6,940 KB
testcase_70 WA -
testcase_71 AC 23 ms
6,940 KB
testcase_72 AC 35 ms
6,944 KB
testcase_73 AC 30 ms
6,940 KB
testcase_74 AC 36 ms
6,940 KB
testcase_75 AC 37 ms
6,940 KB
testcase_76 AC 33 ms
6,940 KB
testcase_77 WA -
testcase_78 AC 43 ms
6,944 KB
testcase_79 AC 37 ms
6,940 KB
testcase_80 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//using uLL = unsigned __int128;
using PT = priority_queue<tuple<ll, ll, ll>, vector<tuple<ll, ll, ll>>, greater<tuple<ll, ll, ll>>>;
using PPQ = priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>;
using PQ = priority_queue<ll, vector<ll>, greater<ll>>;
using P =  pair<ll, ll>;
using vvvvl = vector<vector<vector<vector<ll>>>>;
using vvvi = vector<vector<vector<int>>>;
using vvvl = vector<vector<vector<ll>>>;
using vvvc = vector<vector<vector<char>>>;
using vvvd = vector<vector<vector<double>>>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvs = vector<vector<string>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<pair<ll, ll>>>;
using vvb = vector<vector<bool>>;
using vvd = vector<vector<double>>;
using vp = vector<pair<ll, ll>>;
using vi = vector<int>;
using vl = vector<ll>;
using vu = vector<unsigned long long>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
#define vvvm  vector<vector<vector<mint>>>
#define vvm  vector<vector<mint>>
#define vm  vector<mint>
#define umap  unordered_map
#define uset  unordered_set
#define rrr(l, r) mt()%(r-l+1)+l
#define rep(i, s, f) for(long long i = s; i <= f; i++)
#define rep1(i, s, f) for(long long i = s; i <= f; i++)
#define per(i, s, f) for(long long i = s; i >= f; i--)
#define per1(i, s, f) for(long long i = s; i >= f; i--)
#define all0(x) (x).begin() ,(x).end()
#define all(x) (x).begin() + 1, (x).end()
#define ENDL '\n'
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//これが本当の組み込み関数ってね(笑)

template <typename T>
T or_less(vector<T> &A, T x) { //x以下で最大要素の添字 前提: sort済み 存在しない: -1
    return distance(A.begin(), upper_bound(A.begin(), A.end(), x)-1);
}
template <typename T>
T under(vector<T> &A, T x) { //x未満の最大要素の添字 前提: sort済み 存在しない: -1
    return distance(A.begin(), lower_bound(A.begin(), A.end(), x)-1);
}
template <typename T>
T or_more(vector<T> &A, T x) { //x以上で最小要素の添字  前提: sort済み 存在しない: 配列のサイズ .   //distanceのA.beginは添字を出すために常にA.begin() NG: A.begin() + 1
    return distance(A.begin(), lower_bound(A.begin(), A.end(), x));
}
template <typename T>
T over(vector<T> &A, T x) { //xより大きい最小要素の添字前提: sort済み 存在しない: 配列のサイズ
    return distance(A.begin(), upper_bound(A.begin(), A.end(), x));
}
template <typename T>
vector<T> vec_shift(vector<T> A, ll step, ll dir, ll indexed) {//dir = 1 : 右シフト  dir = -1 : 左シフト
    ll N = A.size() - indexed;
    vector<T> res(N+1);
    rep(i, indexed, N) {
        ll idx = i - step * dir;
        if(idx < indexed) idx += N;
        if(idx > N) idx -= N;
        res.at(i) = A.at(idx);
    }
    return res;
}
template <typename T>
void UNIQUE(vector<T> &A, int indexed) {
    sort(A.begin() + indexed, A.end());
    A.erase(unique(A.begin() + indexed, A.end()), A.end());
}
template <typename T>
vector<T> RLE(vector<T> &A, int indexed) {
   vector<T> res(indexed, -INT_MAX);
   for(int i = indexed; i < int(A.size()); i++) {
       if(i == indexed) res.push_back(A[i]);
       else if(A[i-1] != A[i]) res.push_back(A[i]);
   }
   return res;
}
template <typename T>
void rev90(vector<vector<T>> &A, int indexed) {
    reverse(A.begin() + indexed, A.end());
    int n = A.size();
    rep(i, indexed, n-1) {
        rep(j, i+1, n-1) {
            swap(A.at(i).at(j), A.at(j).at(i));
        }
    }
}
int msb(long long a) {
    if(a == 0) return -1;
    return 64 - int(__builtin_clzll(a));
}
template<typename T = long long>
void chmin(T &a, T b) {
    a = min(a, b);
}
template<typename T = long long>
void chmax(T &a, T b) {
    a = max(a, b);
}
//////////////////////////////////////////////////////////////////////
//数学系
///////////////////////////////////////////////////////////////////////
ll round(ll x, ll i) {return ll(x + 5 * powl(10, i-1))/ll(powl(10, i)) * ll(powl(10, i));}
vp insu_bunkai(ll N) {
    vp res;
    for (ll i = 2; i * i <= N; i++) {
        ll cnt = 0;
        while(N % i == 0) {
            cnt++;
            N /= i;
        }
        if(cnt != 0) res.push_back(P(i, cnt));
    }
    if(N != 1) res.push_back(P(N, 1));
    return res;
}
ll extgcd (ll a, ll b,  ll &x, ll &y) {
    if(b == 0) { x = 1;y = 0;return a;}
    ll d = extgcd(b, a%b, y, x);
    y -= a/b * x;
    return d;
}
template <typename T>
T ceil(T a, T b) {
    assert(b != 0);
    if(a % b == 0) return a / b;
    if((a <= 0 && b < 0) || (a >= 0 && b > 0)) return a/b + 1;
    else return a / b;
}
template <typename T>
T floor(T a, T b) {
    assert(b != 0);
    if(a % b == 0) return a / b;
    if((a <= 0 && b < 0) || (a >= 0 && b > 0)) return a/b;
    else return a/b - 1;
}
long long Calnum(long long l, long long r, long long M, long long m) {//[l, r]で、modMがmである数の個数
    l -= m; r -= m;//並行移
    l = ceil(l, M) * M;
    r = floor(r, M) * M;
    if(l > r) return 0LL;
    return (r - l)/M+1;
}
ll modpow(ll x, ll y, ll mod) {
    if(x > mod) x %= mod;
    if(y == 0) return 1;
    ll res = modpow(x, y >> 1, mod);
    res = res * res % mod;
    if(y & 1) res *= x, res %= mod;
    return res;
}
ll sqrt_(ll a) {
    ll l = 0;
    ll r = 3037000499LL;
    while(l < r) {
        ll mid = (l + r + 1) / 2;
        if(mid * mid <= a) l = mid;
        else r = mid - 1;
    }
    return l;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//グローバル変数を置くところ(情報工学意識高め)
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
const ll int_max = 1001001001;
const ll ll_max = 1001001001001001001LL;
const double pi = 3.141592653589793;
vl dx{0, 1, 0, -1, 0, 1, 1, -1, -1};  // 座標平面において、(番兵) → ↓ ← ↑  ※ 右から時計回り 注 : グリッド or 座標で上下は反転する。
vl dy{0, 0, -1, 0, 1, 1, -1, -1, 1};
//const ll mod = 1000000007;
//const ll mod = 998244353;


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const double eps = 1e-5 ;
int sgn(const double a) {
  return (a < -eps ? -1 : (a > eps ? 1 : 0));
//点が全て整数(制度100%) return (a < 0 ? -1 : (a > 0 ? 1 : 0));
}

void solve() {
    ll Q;
    cin >> Q;
    vd xs(4), ys(4);
    rep(i,1,3) cin >> xs[i] >> ys[i];

    auto d = [](double sx, double sy, double tx, double ty) {
        return sqrt((sx - tx) * (sx - tx) + (sy - ty) * (sy - ty));
    };

    auto dist = [&](double x) {
        double ly = -10000;
        double ry = 10000;
        rep(t, 1, 100) {
            double m1 = (2 * ly + ry)/3;
            double m2 = (ly + 2 * ry)/3;
    
            double d1 = 0, d2 = 0;
            rep(i,1,3) d1 = max(d1, d(xs[i], ys[i], x, m1));
            rep(i,1,3) d2 = max(d2, d(xs[i], ys[i], x, m2));
    
            if(d1 > d2) {
                ly = m1;
            }
            else {
                ry = m2;
            }
        }

        double res = 0;
        rep(i,1,3) res = max(res, d(xs[i], ys[i], x, ly));
        return make_pair(res, ly);
    };


    double lx = -10000;
    double rx = 10000;
    double cy = 0;
    rep(i, 1, 100) {
        double m1 = (2 * lx + rx)/3;
        double m2 = (lx + 2 * rx)/3;

        auto [d1, y1] = dist(m1);
        auto [d2, y2] = dist(m2);

        if(d1 > d2) {
            lx = m1;
            cy = y2;
        }
        else {
            rx = m2;
            cy = y1;
        }
    }

    double cx = lx;

    auto r = dist(cx).first;


    rep(qi,1,Q) {
        double x, y;
        cin >> x >> y;
        double dis = d(x, y, cx, cy);
        if(sgn(dis - r) == 1) {
            cout << "No" << ENDL;
        }
        else {
            cout << "Yes" << ENDL;
        }
    }



    
    

}
//無闇にumapを使わない(特に平方分割時、必要ない事が多い(想定解が平方分割ならば))
//データを分割していく処理では、空配列は作らない方が良い(計算量爆発の温床)
//文字列を0-indexedで扱う時、全体の文字数をどう扱うかは最初に決める&忘れない
//場合分けが沢山の時はreturn忘れを確認
//LISは連続とは限らない。
//mintでも0で割っては行けない(例: 関数の合成とかでやりがち assert落ちする)
//負の数を/2してはいけない(それはfloorでないから)
//DPを書く時は、定義を常に明確にする!定義を変えたいと思ったならば、定義が定まるまでは"必要な情報"を考える。
//尺取り法的な事をする時は、rは勿論"lもNを超え無いようにする"事!(違反するとエラーコード139が出たりする)
//無断で0を平方数にカウントする人もいる
//”部分文字列”と”連続部分文字列”は違うので確認すること
//一般のグラフと、有向辺かつその貼り方に制約がある(多くの場合:番号がで解放に伸びる)はだいぶ違うので確認すること
//座標を2で割った時の”切り捨て側(左側)”を求めるには 誤:(x / 2) マイナスの時!!! 正:floor<ll>(x, 2);
//stringでの数字の下から1桁目は 正:S.at(N-1)  誤:S.at(0)
//if(S.at(i) == 1) ← charなのに1...?
// modは取りましたか...?(´・ω・`)
//sortの比較関数は、 a == b ならば falseを返す必要がある(そうで無いとRE(発生しない場合もある))



int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(15);
    ll T = 1;
    //cin >> T;
    rep(i, 1, T) {
        solve();
    }
  return 0;
}
0