結果
問題 | No.635 自然門松列 |
ユーザー | Ryu |
提出日時 | 2018-01-20 11:25:06 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3 ms / 650 ms |
コード長 | 1,449 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 81,524 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-05 13:11:02 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 3 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 3 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 3 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | AC | 2 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 2 ms
4,376 KB |
testcase_19 | AC | 2 ms
4,380 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 3 ms
4,376 KB |
testcase_22 | AC | 3 ms
4,376 KB |
testcase_23 | AC | 2 ms
4,376 KB |
ソースコード
#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 && c != a && ((a < b && c < b) || (a > b && c > b)); } 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; }