結果

問題 No.3005 トレミーの問題
ユーザー umimel
提出日時 2025-01-17 22:49:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,267 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 165,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-17 22:50:01
合計ジャッジ時間 2,661 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const ll MOD1000000007 = 1000000007;
const ll MOD998244353 = 998244353;
const ll MOD[3] = {999727999, 1070777777, 1000000007};
const ll LINF = 1LL << 60LL;
const int IINF = (1 << 30) - 2;

using ld = long double;
#define eps 1e-60

ld dist(pair<ld, ld> x, pair<ld, ld> y){
    return sqrt((x.fi-y.fi)*(x.fi-y.fi) + (x.se-y.se)*(x.se-y.se));
}

void solve(){
    vector<pair<ld, ld>> P(4);
    for(int i=0; i<4; i++) cin >> P[i].fi >> P[i].se;

    vector<int> p(4); for(int i=0; i<4; i++) p[i] = i;

    do{
        ld ab = dist(P[p[0]], P[p[1]]);
        ld cd = dist(P[p[2]], P[p[3]]);
        ld ad = dist(P[p[0]], P[p[3]]);
        ld bc = dist(P[p[1]], P[p[2]]);
        ld ac = dist(P[p[0]], P[p[2]]);
        ld bd = dist(P[p[1]], P[p[3]]);

        if(ab*cd+ad*bc-ac*bd < eps){
            cout << "YES\n";
            return;
        }
    }while(next_permutation(all(p)));

    cout << "NO\n";
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int T=1;
    //cin >> T;
    while(T--) solve();
}
0