結果
| 問題 |
No.635 自然門松列
|
| ユーザー |
TangentDay
|
| 提出日時 | 2018-01-19 22:22:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 650 ms |
| コード長 | 1,360 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 72,352 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 12:37:05 |
| 合計ジャッジ時間 | 1,643 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp:31:8: warning: built-in function ‘y1’ declared as non-function [-Wbuiltin-declaration-mismatch]
31 | double y1, y2, y3;
| ^~
ソースコード
#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;
}
TangentDay