結果

問題 No.635 自然門松列
ユーザー rickythetarickytheta
提出日時 2018-01-19 22:41:37
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,725 bytes
コンパイル時間 1,245 ms
コンパイル使用メモリ 145,172 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 13:09:07
合計ジャッジ時間 2,140 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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})==x2)){
      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