結果

問題 No.635 自然門松列
コンテスト
ユーザー pirozhki
提出日時 2018-06-01 02:01:55
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,189 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 866 ms
コンパイル使用メモリ 92,644 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-20 04:31:26
合計ジャッジ時間 1,783 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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