結果

問題 No.245 貫け!
ユーザー kotatsugamekotatsugame
提出日時 2020-03-04 12:45:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 65,144 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 01:33:52
合計ジャッジ時間 1,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
int A[200],B[200];
long crs(long ax,long ay,long bx,long by)
{
	return ax*by-ay*bx;
}
main()
{
	cin>>N;
	for(int i=0;i<2*N;i++)cin>>A[i]>>B[i];
	int ans=0;
	for(int i=0;i<2*N;i++)for(int j=i+1;j<2*N;j++)
	{
		int cnt=0;
		long ax=A[i],ay=B[i],bx=A[j],by=B[j];
		if(ax==bx&&ay==by)continue;
		for(int k=0;k<N;k++)
		{
			long cx=A[2*k],cy=B[2*k],dx=A[2*k+1],dy=B[2*k+1];
			cnt+=crs(bx-ax,by-ay,cx-ax,cy-ay)*crs(bx-ax,by-ay,dx-ax,dy-ay)<=0;
		}
		if(ans<cnt)ans=cnt;
	}
	cout<<ans<<endl;
}
0