結果

問題 No.635 自然門松列
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-01-20 00:37:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,425 bytes
コンパイル時間 1,809 ms
コンパイル使用メモリ 173,816 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 00:36:36
合計ジャッジ時間 2,340 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/





double x[3], y[3], xx[3];
//---------------------------------------------------------------------------------------------------
string solve() {
    rep(i, 0, 3) cin >> x[i];
    rep(i, 0, 3) cin >> y[i];

    vector<double> v;
    v.push_back(0);
    rep(i, 0, 3) rep(j, 0, 3) if (i != j and x[i] < x[j] and y[i] > y[j]) {
        double ng = 0, ok = 2020;
        rep(k, 0, 100) {
            double md = (ng + ok) / 2;
            
            double xi = x[i] + y[i] * md;
            double xj = x[j] + y[j] * md;
            
            if (xi > xj) ok = md;
            else ng = md;
        }
        v.push_back(ok);
    }

    set<double> w;
    fore(t, v) {
        w.insert(t - 0.01);
        w.insert(t);
        w.insert(t + 0.01);
    }

    fore(t, w) if(0 <= t) {
        rep(i, 0, 3) xx[i] = x[i] + y[i] * t;

        int ok = 0;
        if (xx[0] < xx[1] and xx[2] < xx[1]) ok = 1;
        if (xx[0] > xx[1] and xx[2] > xx[1]) ok = 1;
        if (ok) return "YES";
    }

    return "NO";
}
//---------------------------------------------------------------------------------------------------
void _main() {
    int N; cin >> N;
    rep(i, 0, N) printf("%s\n", solve().c_str());
}
0