結果
| 問題 |
No.635 自然門松列
|
| コンテスト | |
| ユーザー |
DAyamaCTF
|
| 提出日時 | 2018-01-19 21:58:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,458 bytes |
| コンパイル時間 | 1,718 ms |
| コンパイル使用メモリ | 164,720 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 12:32:42 |
| 合計ジャッジ時間 | 2,660 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount
#define INF 1e16
ll q;
bool judge(vector<double> a){
rep(i,3){
if(a[i]==a[(i+1)%3])return false;
}
if(*max_element(all(a))==a[1]||*min_element(all(a))==a[1])return true;
else return false;
}
int main(){
cin>>q;
while(q--){
vector<double> b,a;
b.resize(3); a.resize(3);
rep(i,3)cin>>b[i];
rep(i,3)cin>>a[i];
if(judge(b)){
cout<<"YES"<<endl;
continue;
}
vector<double> tx;
rep(i,3){
int j=(i+1)%3;
if(a[i]==a[j])continue;
double x=-((b[i]-b[j])/(a[i]-a[j]));
if(x<-1e-9)continue;
tx.push_back(x);
}
bool ok=false;
rep(i,tx.size()){
double x=tx[i];
x+=0.0001;
vector<double> tmp;
rep(j,3){
tmp.push_back(a[j]*x+b[j]);
}
if(judge(tmp)){
ok=true;
cout<<"YES"<<endl;
break;
}
}
if(!ok)cout<<"NO"<<endl;
}
return 0;
}
DAyamaCTF