結果
問題 |
No.635 自然門松列
|
ユーザー |
![]() |
提出日時 | 2018-01-19 22:23:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 650 ms |
コード長 | 1,364 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 72,612 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 08:47:37 |
合計ジャッジ時間 | 1,182 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 |
ソースコード
#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 yy1, y2, y3; double calc(double t){ return (x1 - x2 + (yy1 - y2) * t) * (x3- x2 + (y3 - y2) * t); } bool solve(){ if (x1 == x3 && yy1 == 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 >> yy1 >> y2 >> y3; cout << (solve() ? "YES" : "NO") << endl; } return 0; }