結果
| 問題 | No.635 自然門松列 | 
| コンテスト | |
| ユーザー |  rickytheta | 
| 提出日時 | 2018-01-19 22:41:03 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,725 bytes | 
| コンパイル時間 | 1,546 ms | 
| コンパイル使用メモリ | 158,704 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 12:39:54 | 
| 合計ジャッジ時間 | 2,481 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 WA * 18 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;
#define y1 ____y1
#define y2 ____y2
double x1,x2,x3,y1,y2,y3;
void solve(){
  cin>>x1>>x2>>x3>>y1>>y2>>y3;
  const double eps = 1e-5;
  const double INF = 1e20;
  while(true){
    x1 += eps*y1;
    x2 += eps*y2;
    x3 += eps*y3;
    if(x1!=x2 && x2!=x3 && x1!=x3 && (max({x1,x2,x3})==x2 || min({x1,x2,x3})==x3)){
      puts("YES");
      return;
    }
    double t = INF;
    // x1 & x2
    if(x1<x2 && y1>y2)CHMIN(t, (x2-x1)/(y1-y2));
    if(x1>x2 && y1<y2)CHMIN(t, (x2-x1)/(y1-y2));
    // x1 & x3
    if(x1<x3 && y1>y3)CHMIN(t, (x3-x1)/(y1-y3));
    if(x1>x3 && y1<y3)CHMIN(t, (x3-x1)/(y1-y3));
    // x2 & x3
    if(x2<x3 && y2>y3)CHMIN(t, (x3-x2)/(y2-y3));
    if(x2>x3 && y2<y3)CHMIN(t, (x3-x2)/(y2-y3));
    if(t==INF){
      puts("NO");
      return;
    }
    x1 += t*y1;
    x2 += t*y2;
    x3 += t*y3;
  }
}
int main(){
  int n;
  cin>>n;
  while(n--)solve();
  return 0;
}
            
            
            
        