結果
問題 |
No.635 自然門松列
|
ユーザー |
|
提出日時 | 2018-01-19 21:48:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 956 bytes |
コンパイル時間 | 648 ms |
コンパイル使用メモリ | 72,908 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 12:29:51 |
合計ジャッジ時間 | 1,549 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 9 WA * 14 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; bool is_kadomatsu(double x, double y, double z) { return x != y && x != z && y != z && (x < y && y > z || x > y && y < z); } int main() { int T; cin >> T; while (T--) { double x[3]; double y[3]; for (int i = 0; i < 3; i++) cin >> x[i]; for (int i = 0; i < 3; i++) cin >> y[i]; vector<double> cand; cand.push_back(0); cand.push_back(12312312); // x[i]+y[i]*k == x[j]+y[j]*k for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (y[j] != y[i]) { double c = (x[i] - x[j]) / (y[j] - y[i]); if (c >= 1e-6) { cand.push_back(c - 1e-6); } cand.push_back(c + 1e-6); } } } bool ok = false; for (double c : cand) { ok |= is_kadomatsu(x[0] + y[0] * c, x[1] + y[1] * c, x[2] + y[2] * c); } puts(ok ? "YES" : "NO"); } }