結果

問題 No.635 自然門松列
ユーザー imulanimulan
提出日時 2018-01-28 04:59:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,380 bytes
コンパイル時間 1,430 ms
コンパイル使用メモリ 165,692 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 10:37:08
合計ジャッジ時間 3,291 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const double LIM = 20000;

int x[3],y[3];
bool solve(){
    double l=0, r=LIM;
    bool ok = true;
    for(int i:{0,2}){
        if(y[i]==y[1]) ok &= (x[1]-x[i]>0);
        else{
            double dy = y[i]-y[1];
            if(dy>0) r = min(r,(x[1]-x[i])/dy);
            else l = max(l,(x[1]-x[i])/dy);
        }
    }
    if(ok && l<r) return true;

    l=0;
    r=LIM;
    ok = true;
    for(int i:{0,2}){
        if(y[i]==y[1]) ok &= (x[1]-x[i]<0);
        else{
            double dy = y[i]-y[1];
            if(dy>0) l = max(l,(x[1]-x[i])/dy);
            else r = min(r,(x[1]-x[i])/dy);
        }
    }
    if(ok && l<r) return true;
    return false;
}

int main(){
    int n;
    scanf(" %d", &n);
    while(n--){
        rep(i,3) scanf(" %d", &x[i]);
        rep(i,3) scanf(" %d", &y[i]);

        if(solve()) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}
0