結果

問題 No.635 自然門松列
ユーザー TangentDayTangentDay
提出日時 2018-01-19 22:22:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 650 ms
コード長 1,360 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 71,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 00:20:56
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:31:8: warning: built-in function ‘y1’ declared as non-function [-Wbuiltin-declaration-mismatch]
 double y1, y2, y3;
        ^~

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <cstdio>
// #include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

double x1, x2, x3;
double y1, y2, y3;

double calc(double t){
    return (x1 - x2 + (y1 - y2) * t) * (x3- x2 + (y3 - y2) * t);
}

bool solve(){
    if (x1 == x3 && y1 == y3) return false;
    if (calc(0) > 1e-10) return true;
    if (calc(1e18) > 1e10) return true;
    // cout << "well";
    double le = 0, ri = 1e18;
    REP(_,200){
        // cout << le << " " << ri << endl;
        double m1 = (2 * le + ri) / 3.0, m2 = (le + 2 * ri) / 3.0;
        if (calc(m1) > calc(m2)) ri = m2;
        else le = m1;
    }
    // cout << le << endl;
    return calc(le) > 1e-10;
}

int main() {
    int n;
    cin >> n;

    while (n--){
        cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3;
        cout << (solve() ? "YES" : "NO") << endl;
    }
    return 0;
}
0