結果

問題 No.635 自然門松列
ユーザー どらら
提出日時 2018-01-19 23:21:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 978 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 168,160 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 12:53:11
合計ジャッジ時間 2,806 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


bool solve(const vector<int>& x, const vector<int>& y){
  if(x[0] == x[1] && y[0] == y[1]) return false;
  if(x[1] == x[2] && y[1] == y[2]) return false;
  if(x[0] == x[2] && y[0] == y[2]) return false;

  double T1 = (x[0] - x[1]) / (double)(y[1] - y[0]);
  double T2 = (x[1] - x[2]) / (double)(y[2] - y[1]);

  double mn = min(T1, T2), mx = max(T1, T2);
  if(mx < 0) return false;
  if(isinf(mn) > 0 && isinf(mx) > 0) return false;

  return true;
}

int main(){
  int N;
  cin >> N;

  rep(t,N){
    vector<int> x(3), y(3);
    rep(i,3) cin >> x[i];
    rep(i,3) cin >> y[i];

    if(solve(x, y)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return 0;
}

0