結果

問題 No.245 貫け!
ユーザー TawaraTawara
提出日時 2015-07-19 02:01:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,373 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 77,772 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 19:07:56
合計ジャッジ時間 1,749 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PII>VPII;
typedef vector <PIL> VPIL;


#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define sort(c) sort((c).begin(),(c).end())

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

#define MAX_INT 2147483647

int cross_prod(PII a, PII b, PII pi){
	return ( (b.first - a.first) * (b.second - pi.second) 
		   - (b.second - a.second) * (a.first - pi.first) );
}
int count(PII a, PII b, VPII ep1, VPII ep2, int N){
	int num = 0;
	rep(i,N){
		if (cross_prod(a,b,ep1[i]) * cross_prod(a,b,ep2[i]) <= 0) 
			num += 1;
	}
	return num;
}
int main(){
	int N, max_num = 1;
	VPII ep1, ep2, p;
	cin >> N;
	ep1.resize(N); ep2.resize(N);
	rep(i,N){
		cin >> ep1[i].first >> ep1[i].second >> ep2[i].first >> ep2[i].second;
		p.push_back(ep1[i]);
		p.push_back(ep2[i]);
	}
	rep(i,2*N-1)
		range(j,i+1,2*N){
			if (p[i] != p[j])
				max_num = max(max_num, count(p[i],p[j],ep1,ep2, N));
		}

	cout << max_num << endl;
	return 0;
}
0