結果

問題 No.635 自然門松列
ユーザー maimai
提出日時 2017-04-09 18:09:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,032 bytes
コンパイル時間 1,409 ms
コンパイル使用メモリ 166,404 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-11 12:57:14
合計ジャッジ時間 2,897 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"

#ifdef WINT_MIN
#define __MAI
#endif

using namespace std;
typedef long long int ll;


// 門松列の判定
inline bool kadomatu(int a, int b, int c) {
    return a != b&&b != c&&c != a && ((a<b && c<b) || (a>b && c>b));
}


bool solve(double x1, double x2, double x3, double y1, double y2, double y3) {

    // 時間0で🎍
    if (kadomatu(x1, x2, x3)) return true;
    // 十分な時間経過で🎍
    if (kadomatu(y1, y2, y3)) return true;

    for (double t = 0.0; t < 100; t+=0.001) {

        // 時刻tcで🎍かどうか調べる
        if (kadomatu(x1 + y1*t, x2 + y2*t, x3 + y3*t)) {
            return true;
        }
    }
    return false;
}


int main() {
    int n;
    double x1, x2, x3, y1, y2, y3;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3;
        
        if (solve(x1, x2, x3, y1, y2, y3)) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }



    return 0;
}
0