結果
| 問題 |
No.635 自然門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-19 21:47:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 983 bytes |
| コンパイル時間 | 1,050 ms |
| コンパイル使用メモリ | 73,684 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 12:29:23 |
| 合計ジャッジ時間 | 1,680 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 WA * 2 |
ソースコード
#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], x[i] *= 1.1092312;
for (int i = 0; i < 3; i++) cin >> y[i];
vector<double> cand;
cand.push_back(0);
cand.push_back(123123123);
// 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 >= 0) {
cand.push_back(c - 0.000001);
cand.push_back(c + 0.000001);
}
}
}
}
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");
}
}