結果
| 問題 |
No.2602 Real Collider
|
| コンテスト | |
| ユーザー |
ococonomy1
|
| 提出日時 | 2024-01-12 21:34:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,141 bytes |
| コンパイル時間 | 1,153 ms |
| コンパイル使用メモリ | 107,240 KB |
| 最終ジャッジ日時 | 2025-02-18 17:51:19 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 49 |
ソースコード
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll,int>;
#define TEST cerr << "TEST" << endl
#define AMARI 998244353
// #define AMARI 1000000007
#define TIME_LIMIT 1980000
#define el '\n'
#define El '\n'
//三角形の外心の中心を返す
pair<long double,long double> ococo_gaisetuen_tyuusin(long double x1,long double y1,long double x2,long double y2,long double x3,long double y3){
long double a = x1,b = y1,c = x2,d = y2,e = x3,f = y3;
long double bunsiy = (e - a) * (a * a + b * b - c * c - d * d) - (c - a) * (a * a + b * b - e * e - f * f);
long double bunboy = 2 * (e - a) * (b - d) - 2 * (c - a) * (b - f);
if(abs(bunboy) <= 1e-7){
//この時、一直線に並んでいる
if((x1 > x2) == (x2 > x3)){
return pair((x1 + x3) / 2,(y1 + y3) / 2);
}
if((x1 > x3) == (x3 > x2)){
return pair((x1 + x2) / 2,(y1 + y2) / 2);
}
return pair((x2 + x3) / 2,(y2 + y3) / 2);
}
long double bunsix,bunbox;
if(a != c){
bunsix = 2 * (b - d) * (bunsiy / bunboy) - a * a - b * b + c * c + d * d;
bunbox = 2 * (c - a);
}
else{
bunsix = 2 * (b - f) * (bunsiy / bunboy) - a * a - b * b + e * e + f * f;
bunbox = 2 * (e - a);
}
return pair(bunsix / bunbox,bunsiy / bunboy);
}
#define MULTI_TEST_CASE false
void solve(void) {
//問題を見たらまず「この問題設定から言えること」をいっぱい言ってみる
//一個解答に繋がりそうな解法が見えても、実装や細かい考察に時間がかかりそうなら別の方針やを考えてみる
//特に添え字周りはそのままやると面倒&言い換えが有効なことが多いので書き始める前にじっくり考える
int q;
cin >> q;
long double xa,ya,xb,yb,xc,yc;
cin >> xa >> ya >> xb >> yb >> xc >> yc;
xa /= 100; ya /= 100;
xb /= 100; yb /= 100;
xc /= 100; yc /= 100;
long double cx,cy;
tie(cx,cy) = ococo_gaisetuen_tyuusin(xa,ya,xb,yb,xc,yc);
long double r2 = (cx - (long double)xa) * (cx - (long double)xa) + (cy - (long double)ya) * (cy - (long double)ya);
while(q--){
long double x,y;
cin >> x >> y;
x /= 100; y /= 100;
if((cx - (long double)x) * (cx - (long double)x) + (cy - (long double)y) * (cy - (long double)y) > r2){
cout << "No" << el;
continue;
}
cout << "Yes" << el;
}
return;
}
void calc(void) {
return;
}
signed main(void) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
calc();
int t = 1;
if(MULTI_TEST_CASE) cin >> t;
while(t--) {
solve();
}
return 0;
}
ococonomy1