結果

問題 No.245 貫け!
ユーザー cielciel
提出日時 2015-07-18 00:31:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 75,944 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 18:40:32
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 9 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cfloat>
using namespace std;
typedef long long val_t;
typedef complex<val_t> P;
typedef vector<P> VP;

val_t cross(const P &a,const P &b){return (conj(a)*b).imag();}
val_t dot(const P &a,const P &b){return (conj(a)*b).real();}
bool intersectLS(const VP &l, const VP &s) {
	return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
		cross(l[1]-l[0], s[1]-l[0]) <= 0; // s[1] is right of l
}
int main(){
	int n;
	scanf("%d",&n);
	vector<VP> lst(n);
	for(int i=0;i<n;i++){
		long long sx,sy,ex,ey;
		scanf("%lld%lld%lld%lld",&sx,&sy,&ex,&ey);
		lst[i]={P(sx,sy),P(ex,ey)};
	}
	int R=0;
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
		vector<VP> x={{lst[i][0],lst[j][0]},{lst[i][1],lst[j][0]},{lst[i][0],lst[j][1]},{lst[i][1],lst[j][1]}};
		for(auto &e:x){
			int r=0;
			for(int k=0;k<n;k++)r+=intersectLS(e,lst[k]);
			if(R<r)R=r;
		}
	}
	printf("%d\n",R);
}
0