結果
問題 | No.635 自然門松列 |
ユーザー |
|
提出日時 | 2018-01-28 04:59:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,380 bytes |
コンパイル時間 | 1,665 ms |
コンパイル使用メモリ | 167,596 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-29 08:19:17 |
合計ジャッジ時間 | 2,740 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 WA * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} const double LIM = 20000; int x[3],y[3]; bool solve(){ double l=0, r=LIM; bool ok = true; for(int i:{0,2}){ if(y[i]==y[1]) ok &= (x[1]-x[i]>0); else{ double dy = y[i]-y[1]; if(dy>0) r = min(r,(x[1]-x[i])/dy); else l = max(l,(x[1]-x[i])/dy); } } if(ok && l<r) return true; l=0; r=LIM; ok = true; for(int i:{0,2}){ if(y[i]==y[1]) ok &= (x[1]-x[i]<0); else{ double dy = y[i]-y[1]; if(dy>0) l = max(l,(x[1]-x[i])/dy); else r = min(r,(x[1]-x[i])/dy); } } if(ok && l<r) return true; return false; } int main(){ int n; scanf(" %d", &n); while(n--){ rep(i,3) scanf(" %d", &x[i]); rep(i,3) scanf(" %d", &y[i]); if(solve()) printf("YES\n"); else printf("NO\n"); } return 0; }