結果

問題 No.245 貫け!
ユーザー tailstails
提出日時 2015-07-17 23:07:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 547 bytes
コンパイル時間 1,073 ms
コンパイル使用メモリ 144,624 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 18:08:37
合計ジャッジ時間 2,175 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)

int N;
struct P { int x,y; };
P p[100][2];

P l,m;

int s(int x){return x<0?-1:x>0?1:0;}
int f(P const & p){
	return s((p.x-l.x)*(m.y-l.y)-(p.y-l.y)*(m.x-l.x));
}

int main(){
	cin>>N;
	rep(i,N)cin>>p[i][0].x>>p[i][0].y>>p[i][1].x>>p[i][1].y;

	int b=1;
	rep(j,N)rep(jj,2)rep(k,j)rep(kk,2){
		l=p[j][jj];
		m=p[k][kk];
		if(l.x!=m.x||l.y!=m.y){
			int c=0;
			rep(i,N){
				if(f(p[i][0])*f(p[i][1])<=0){
					++c;
				}
			}
			if(b<c)b=c;
		}
	}
	cout<<b;
}
0