結果

問題 No.635 自然門松列
ユーザー どららどらら
提出日時 2018-01-19 23:21:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 978 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 167,236 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-26 00:34:13
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,504 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;
#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