結果

問題 No.635 自然門松列
ユーザー pirozhkipirozhki
提出日時 2018-06-01 02:01:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,189 bytes
コンパイル時間 2,554 ms
コンパイル使用メモリ 69,384 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-12 21:14:18
合計ジャッジ時間 3,988 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 38 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

struct Pine {
	double x[3];
	double y[3];
};

template<typename T>
inline int Max(T begin, T end) {
	return distance(begin, max_element(begin, end));
}

template<typename T>
inline int Min(T begin, T end) {
	return distance(begin, min_element(begin, end));
}

template<typename T>
inline bool HasEqual(const T x[]) {
	return x[0] == x[1] || x[0] == x[2] || x[1] == x[2];
}

int main(){
	int n;
	cin >> n;

	vector<Pine> pines;

	for (int i = 0; i < n; i++) {
		Pine p;
		cin >> p.x[0] >> p.x[1] >> p.x[2] >> p.y[0] >> p.y[1] >> p.y[2];
		pines.emplace_back(p);
	}

	for (Pine p : pines) {
		if (!HasEqual(p.x) && (Max(p.x, p.x + 3) == 1 || Min(p.x, p.x + 3) == 1)) {
			cout << "YES" << endl;
			continue;
		}

		bool yes = false;
		while (!(Max(p.x, p.x+3) == Max(p.y, p.y + 3)) && !(Min(p.x, p.x + 3) == Min(p.y, p.y + 3))) {
			p.x[0] += p.y[0]*0.001;
			p.x[1] += p.y[1]*0.001;
			p.x[2] += p.y[2]*0.001;
			if (*max_element(p.x, p.x + 3) == p.x[1] || *min_element(p.x, p.x + 3) == p.x[1]) {
				yes = true;
				break;
			}
		}
		cout << (yes ? "YES" : "NO") << endl;
	}

	return 0;
}
0