結果

問題 No.2602 Real Collider
ユーザー SSRSSSRS
提出日時 2024-01-12 22:34:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 378 ms / 2,000 ms
コード長 1,754 bytes
コンパイル時間 3,038 ms
コンパイル使用メモリ 202,924 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 22:35:36
合計ジャッジ時間 16,086 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 378 ms
6,548 KB
testcase_11 AC 135 ms
6,676 KB
testcase_12 AC 177 ms
6,676 KB
testcase_13 AC 82 ms
6,676 KB
testcase_14 AC 191 ms
6,676 KB
testcase_15 AC 118 ms
6,676 KB
testcase_16 AC 159 ms
6,676 KB
testcase_17 AC 172 ms
6,676 KB
testcase_18 AC 126 ms
6,676 KB
testcase_19 AC 148 ms
6,676 KB
testcase_20 AC 206 ms
6,676 KB
testcase_21 AC 118 ms
6,676 KB
testcase_22 AC 144 ms
6,676 KB
testcase_23 AC 94 ms
6,676 KB
testcase_24 AC 136 ms
6,676 KB
testcase_25 AC 142 ms
6,676 KB
testcase_26 AC 129 ms
6,676 KB
testcase_27 AC 162 ms
6,676 KB
testcase_28 AC 171 ms
6,676 KB
testcase_29 AC 143 ms
6,676 KB
testcase_30 AC 151 ms
6,676 KB
testcase_31 AC 171 ms
6,676 KB
testcase_32 AC 152 ms
6,676 KB
testcase_33 AC 160 ms
6,676 KB
testcase_34 AC 163 ms
6,676 KB
testcase_35 AC 106 ms
6,676 KB
testcase_36 AC 100 ms
6,676 KB
testcase_37 AC 181 ms
6,676 KB
testcase_38 AC 180 ms
6,676 KB
testcase_39 AC 173 ms
6,676 KB
testcase_40 AC 83 ms
6,676 KB
testcase_41 AC 194 ms
6,676 KB
testcase_42 AC 151 ms
6,676 KB
testcase_43 AC 158 ms
6,676 KB
testcase_44 AC 228 ms
6,676 KB
testcase_45 AC 124 ms
6,676 KB
testcase_46 AC 118 ms
6,676 KB
testcase_47 AC 175 ms
6,676 KB
testcase_48 AC 133 ms
6,676 KB
testcase_49 AC 113 ms
6,676 KB
testcase_50 AC 89 ms
6,676 KB
testcase_51 AC 95 ms
6,676 KB
testcase_52 AC 67 ms
6,676 KB
testcase_53 AC 159 ms
6,676 KB
testcase_54 AC 124 ms
6,676 KB
testcase_55 AC 142 ms
6,676 KB
testcase_56 AC 138 ms
6,676 KB
testcase_57 AC 126 ms
6,676 KB
testcase_58 AC 50 ms
6,676 KB
testcase_59 AC 151 ms
6,676 KB
testcase_60 AC 141 ms
6,676 KB
testcase_61 AC 110 ms
6,676 KB
testcase_62 AC 165 ms
6,676 KB
testcase_63 AC 184 ms
6,676 KB
testcase_64 AC 213 ms
6,676 KB
testcase_65 AC 107 ms
6,676 KB
testcase_66 AC 176 ms
6,676 KB
testcase_67 AC 81 ms
6,676 KB
testcase_68 AC 97 ms
6,676 KB
testcase_69 AC 69 ms
6,676 KB
testcase_70 AC 81 ms
6,676 KB
testcase_71 AC 102 ms
6,676 KB
testcase_72 AC 155 ms
6,676 KB
testcase_73 AC 128 ms
6,676 KB
testcase_74 AC 161 ms
6,676 KB
testcase_75 AC 173 ms
6,676 KB
testcase_76 AC 150 ms
6,676 KB
testcase_77 AC 159 ms
6,676 KB
testcase_78 AC 194 ms
6,676 KB
testcase_79 AC 169 ms
6,676 KB
testcase_80 AC 195 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
struct point{
  long long x, y;
  point(){
  }
  point(long long x, long long y): x(x), y(y){
  }
  point operator -(point P){
    return point(x - P.x, y - P.y);
  }
  point operator *(long long k){
    return point(x * k, y * k);
  }
};
istream& operator >>(istream& is, point &P){
  is >> P.x >> P.y;
  return is;
}
long long norm_sq(point P){
  return P.x * P.x + P.y * P.y;
}
long long dot(point P, point Q){
  return P.x * Q.x + P.y * Q.y;
}
int main(){
  int Q;
  cin >> Q;
  point A, B, C;
  cin >> A >> B >> C;
  char c = '.';
  if (dot(B - A, C - A) < 0){
    c = 'A';
  }
  if (dot(C - B, A - B) < 0){
    c = 'B';
  }
  if (dot(A - C, B - C) < 0){
    c = 'C';
  }
  point P1, P2;
  long long mul;
  if (c != '.'){
    if (c == 'B'){
      swap(A, B);
    }
    if (c == 'C'){
      swap(A, C);
    }
    P1.x = B.x + C.x;
    P1.y = B.y + C.y;
    P2.x = B.x * 2;
    P2.y = B.y * 2;
    mul = 2;
  } else {
    long long X_num = norm_sq(A) * (B.y - C.y) + norm_sq(B) * (C.y - A.y) + norm_sq(C) * (A.y - B.y);
    long long Y_num = -(norm_sq(A) * (B.x - C.x) + norm_sq(B) * (C.x - A.x) + norm_sq(C) * (A.x - B.x));
    long long den = ((A.x - B.x) * (B.y - C.y) - (B.x - C.x) * (A.y - B.y)) * 2;
    P1.x = X_num;
    P1.y = Y_num;
    P2.x = A.x * den;
    P2.y = A.y * den;
    mul = den;
  }
  for (int i = 0; i < Q; i++){
    long long X, Y;
    cin >> X >> Y;
    X *= mul;
    Y *= mul;
    __int128_t d = (__int128_t) (X - P1.x) * (X - P1.x) + (__int128_t) (Y - P1.y) * (Y - P1.y);
    __int128_t r = (__int128_t) (P2.x - P1.x) * (P2.x - P1.x) + (__int128_t) (P2.y - P1.y) * (P2.y - P1.y);
    if (d <= r){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
0