結果

問題 No.3180 angles sum
ユーザー SnowBeenDiding
提出日時 2025-08-14 19:28:09
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,164 bytes
コンパイル時間 5,999 ms
コンパイル使用メモリ 332,264 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-08-14 19:28:19
合計ジャッジ時間 9,422 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

using mint = modint998244353;

struct fraction {
    ll p, q;
    fraction(ll P = 0, ll Q = 1) : p(P), q(Q) {
        if (q < 0) {
            p = -p;
            q = -q;
        }
    }

    bool operator<(const fraction &other) const {
        return p * other.q < other.p * q;
    }
    bool operator<=(const fraction &other) const {
        return p * other.q <= other.p * q;
    }
    bool operator>(const fraction &other) const {
        return p * other.q > other.p * q;
    }
    bool operator>=(const fraction &other) const {
        return p * other.q >= other.p * q;
    }
    bool operator==(const fraction &other) const {
        return p * other.q == other.p * q;
    }

    fraction operator+(const fraction &other) const {
        return fraction(p * other.q + other.p * q, q * other.q);
    }
    fraction operator-(const fraction &other) const {
        return fraction(p * other.q - other.p * q, q * other.q);
    }
    fraction operator*(const fraction &other) const {
        return fraction(p * other.p, q * other.q);
    }
    fraction operator/(const fraction &other) const {
        return fraction(p * other.q, q * other.p);
    }
    fraction operator+=(const fraction &other) { return *this = *this + other; }
    fraction operator-=(const fraction &other) { return *this = *this - other; }
    fraction operator*=(const fraction &other) { return *this = *this * other; }
    fraction operator/=(const fraction &other) { return *this = *this / other; }
};

fraction input() {
    ll x, y;
    cin >> x >> y;
    fraction ret(y, x);
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    int t;
    cin >> t;
    while (t--) {
        auto A = input();
        auto B = input();
        auto C = input();
        bool ok = (A * B * C) == (C - A - B);
        int neg = (A.p < 0) + (B.p < 0) + (C.p < 0);
        ok &= (neg % 2 == 0);
        cout << (ok ? "Yes\n" : "No\n");
    }
}
0