結果

問題 No.635 自然門松列
コンテスト
ユーザー kotatsugame
提出日時 2020-03-07 05:52:42
言語 C++14
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 3 ms / 650 ms
コード長 690 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 596 ms
コンパイル使用メモリ 72,552 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-29 09:18:44
合計ジャッジ時間 1,372 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #
raw source code

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
int X[3],Y[3];
main()
{
	cin>>N;
	for(;N--;)
	{
		for(int i=0;i<3;i++)cin>>X[i];
		for(int i=0;i<3;i++)cin>>Y[i];
		vector<int>id={0,1,2};
		bool flag=false;
		do{
			if(id[1]==1)continue;
			double L=0,R=1e15;
			for(int i=0;i<2;i++)
			{
				long ax=X[id[i]],ay=Y[id[i]],bx=X[id[i+1]],by=Y[id[i+1]];
				if(ay==by)
				{
					if(bx-ax<0);
					else R=-1;
				}
				else if(ay>by)
				{
					L=max(L,(bx-ax)/(double)(ay-by));
				}
				else
				{
					R=min(R,(bx-ax)/(double)(ay-by));
				}
			}
			if(L<R)flag=true;
		}while(next_permutation(id.begin(),id.end()));
		cout<<(flag?"YES":"NO")<<endl;
	}
}
0