結果
| 問題 |
No.635 自然門松列
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2018-01-19 22:43:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,244 bytes |
| コンパイル時間 | 883 ms |
| コンパイル使用メモリ | 74,224 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 12:41:37 |
| 合計ジャッジ時間 | 1,725 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 WA * 5 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
bool foo(int x[3], int y[3]) {
for (int i = 0; i < 3; i++)
for (int j = 0; j < i; j++)
if (y[i] == y[j] && x[i] == x[j]) return false;
if (y[1] > y[0] && y[1] > y[2]) return true;
if (x[1] > x[0] && x[1] > x[2]) return true;
for (int i = 0; i < 3; i += 2)
if (x[1] <= x[i] && y[1] <= y[i]) return false;
if (y[1] <= y[0] && y[1] <= y[2]) return false;
if (y[1] > y[2]) {
swap(x[0], x[2]);
swap(y[0], y[2]);
}
return (x[0] - x[1]) * (y[1] - y[2]) < (x[2] - x[1]) * (y[1] - y[0]);
}
bool is_kadomatsu(int x[3], int y[3]) {
if (foo(x, y)) return true;
for (int j = 0; j < 3; j++) {
x[j] *= -1;
y[j] *= -1;
}
if (foo(x, y)) return true;
return false;
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int x[3], y[3];
for (int j = 0; j < 3; j++) {
cin >> x[j];
}
for (int j = 0; j < 3; j++) {
cin >> y[j];
}
cout << (is_kadomatsu(x, y) ? "YES" : "NO") << endl;
}
return 0;
}
merom686