結果

問題 No.635 自然門松列
ユーザー kotatsugamekotatsugame
提出日時 2020-03-07 05:52:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 650 ms
コード長 690 bytes
コンパイル時間 641 ms
コンパイル使用メモリ 73,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 11:52:49
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#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