結果

問題 No.245 貫け!
ユーザー kotatsugamekotatsugame
提出日時 2020-03-04 12:28:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 747 bytes
コンパイル時間 1,146 ms
コンパイル使用メモリ 89,624 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 01:33:40
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int N;
int A[100],B[100],C[100],D[100];
int cnt(double theta)
{
	vector<pair<double,double> >X;
	double c=cos(theta),s=sin(theta);
	for(int i=0;i<N;i++)
	{
		double L=A[i]*c-B[i]*s;
		double R=C[i]*c-D[i]*s;
		X.push_back(minmax(L,R));
	}
	sort(X.begin(),X.end());
	priority_queue<double>P;
	int ret=0;
	for(pair<double,double>p:X)
	{
		while(!P.empty()&&-P.top()<p.first-1e-10)P.pop();
		P.push(-p.second);
		ret=max(ret,(int)P.size());
	}
	return ret;
}
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i]>>B[i]>>C[i]>>D[i];
	int ans=0;
	const int LIM=1e4;
	for(int i=0;i<LIM;i++)
	{
		ans=max(ans,cnt(M_PI*i/LIM));
	}
	cout<<ans<<endl;
}
0