結果

問題 No.2602 Real Collider
ユーザー GlinTFrauleinGlinTFraulein
提出日時 2024-01-12 23:52:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,482 bytes
コンパイル時間 5,050 ms
コンパイル使用メモリ 268,512 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-28 00:28:01
合計ジャッジ時間 20,341 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 215 ms
5,376 KB
testcase_13 AC 101 ms
5,376 KB
testcase_14 AC 225 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 153 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 193 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep3(i, n, k) for (ll i = k; i < n; i++)
#define all(a) a.begin(), a.end()
#define YNeos(bool) (bool ? "Yes" : "No")
#define vllin(a, n) vll a(n); rep(i, n) cin >> a[i]
#define vchin(a, n) vec<char> a(n); rep(i, n) cin >> a[i]


using namespace std;
const ll INF = 1LL << 60;
const ll mod = 998244353;
//const ll mod = 1000000007;
const double pi = acos(-1);
const double EPS = 1 / 1000000000;  //10^-9

//#ifdef ATCODER
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
//#endif

//Prototype declaration
template <class T, class... U> void gin(T&&, U&&...);
template <typename T> vector<T> read(ll);
template <typename T> void printvec(const T&);
template <class T, class... U> void printany(T&&, U&&...);

//Main Program
int main() {
  ll q; cin >> q;
  vec<pair<double, double>> abc(3);
  rep(i, 3) {
    double x, y; gin(x, y);
    abc[i] = make_pair(x, y);
  }

  sort(all(abc));
  bool isonline = 0;
  double slope_13, itcpt_13, slope_12, itcpt_12, nor_slope_13, nor_itcpt_13, nor_slope_12, nor_itcpt_12, rad;
  pair<double, double> center;  

  if ((abc[0].first == abc[1].first && abc[0].first == abc[2].first) || (abc[0].second == abc[1].second && abc[0].second == abc[2].second)) isonline = 1;
  
  if (!isonline) {
    slope_13 = (abc[2].second - abc[0].second) / (abc[2].first - abc[0].first);
    itcpt_13 = abc[0].second - abc[0].first * slope_13;
    if (abc[1].second - (slope_13 * abc[1].first + itcpt_13) < EPS) isonline = 1;
  }

  if (!isonline) {
    slope_12 = (abc[1].second - abc[0].second) / (abc[1].first - abc[0].first);
    itcpt_12 = abc[0].second - abc[0].first * slope_13;

    nor_slope_12 = -1 / slope_12;
    nor_slope_13 = -1 / slope_13;
    nor_itcpt_12 = (abc[0].second + abc[1].second) / 2 + (abc[0].first + abc[1].first) / (slope_12 * 2);
    nor_itcpt_13 = (abc[0].second + abc[2].second) / 2 + (abc[0].first + abc[2].first) / (slope_13 * 2);

    double centerx = (nor_itcpt_12 - nor_itcpt_13) / (nor_slope_12 - nor_slope_13);
    center = make_pair(centerx, nor_slope_12 * centerx + nor_itcpt_12);
    rad = (center.first - abc[0].first) * (center.first - abc[0].first) + (center.second - abc[0].second) * (center.second - abc[0].second);
  }

  if (isonline) {
    center = make_pair((abc[0].first + abc[2].first) / 2, (abc[0].second + abc[2].second) / 2);
    rad = (center.first - abc[0].first) * (center.first - abc[0].first) + (center.second - abc[0].second) * (center.second - abc[0].second);
  }


  rep (itr, q) {
    double x, y; gin(x, y);
    ll kyori = (center.first - x) * (center.first - x) + (center.second - y) * (center.second - y);
    cout << YNeos(kyori <= rad) << endl;
  }
  




}


//Function Definition
void gin() {return;}
template <class T, class... U> void gin(T&& now,  U&&... next) {
  cin >> now;
  gin(forward<U> (next)...);
}

template <typename T> vector<T> read(ll n) {
  vector<T> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  return v;
}

template <typename T> void printvec(const T& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i];
    if (i == a.size() - 1) cout << endl;
    else cout << ' ';
  }
}

void printany() {cout << endl;}
template <class T, class... U> void printany(T&& now, U&&... next) {
  cout << now << ' ';
  printany(forward<U> (next)...);
}
0