結果

問題 No.635 自然門松列
ユーザー square1001square1001
提出日時 2018-01-21 15:25:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 19:37:00
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int n, a[3], b[3];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
		if (b[0] > b[1] && b[1] < b[2] && (a[0] != a[2] || b[0] != b[2])) cout << "YES" << endl;
		else if (b[0] < b[1] && b[1] > b[2] && (a[0] != a[2] || b[0] != b[2])) cout << "YES" << endl;
		else {
			a[0] *= 1000; a[1] *= 1000; a[2] *= 1000;
			bool flag = false;
			for (int j = 0; j <= 1000000; j++) {
				int x = a[0] + b[0] * j, y = a[1] + b[1] * j, z = a[2] + b[2] * j;
				if ((x < y && y > z && x != z) || (x > y && y < z && x != z)) {
					cout << "YES" << endl;
					flag = true;
					break;
				}
			}
			if (!flag) cout << "NO" << endl;
		}
	}
	return 0;
}
0