結果

問題 No.635 自然門松列
ユーザー rickythetarickytheta
提出日時 2018-01-19 22:41:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,725 bytes
コンパイル時間 1,216 ms
コンパイル使用メモリ 145,296 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-26 00:23:45
合計ジャッジ時間 2,250 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0