結果
| 問題 | No.635 自然門松列 | 
| コンテスト | |
| ユーザー |  Ryu | 
| 提出日時 | 2018-01-20 11:17:03 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,433 bytes | 
| コンパイル時間 | 697 ms | 
| コンパイル使用メモリ | 83,284 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-25 02:08:34 | 
| 合計ジャッジ時間 | 1,758 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 10 WA * 13 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <cstring>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using edge = struct
{
    int to;
    int cost;
};
bool check(double a, double b, double c)
{
    return a != b && b != c && (a < b && c < b) || (a > b && c > a);
}
bool solve(double x1, double x2, double x3, double y1, double y2, double y3)
{
    if (check(x1, x2, x3))
        return true;
    if (check(y1, y2, y3))
        return true;
    double tl = 0.0;
    double th = 1e9;
    double tc;
    rep(i, 80)
    {
        tc = (tl + th) / 2;
        if (check(x1 + y1 * tc, x2 + y2 * tc, x3 + y3 * tc))
            return true;
        if (x1 + y1 * (-1e9) < x3 + y3 * (-1e9) == x1 + y1 * tc < x3 + y3 * tc)
            tl = tc;
        else
            th = tc;
    }
    return false;
}
int main()
{
    int n;
    double x1, x2, x3, y1, y2, y3;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3;
        if (solve(x1, x2, x3, y1, y2, y3))
            cout << "YES" << endl;
        else 
            cout << "NO" << endl;
    }
    return 0;
}
            
            
            
        