結果

問題 No.245 貫け!
ユーザー vain0vain0
提出日時 2015-07-18 00:45:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,677 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 77,588 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 18:43:10
合計ジャッジ時間 1,540 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 9 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 <cassert>
#include <functional>
#include <set>
#include <ctime>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#ifndef ONLINE_JUDGE //POJ
# include <complex>
# include <random>
# include <array>
# define mkt make_tuple
# define empb emplace_back
#endif
#ifdef _LOCAL
# include "for_local.h"
#else
# define debug if (false)
#endif
using namespace std;
typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull;
#define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I))
#define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I))
#define mkp make_pair
#define all(_X) (_X).begin(), (_X).end()

struct Point
{
	int x, y;
};
Point operator - (Point const& lhs, Point const& rhs)
{
	return Point { lhs.x - rhs.x, lhs.y - rhs.y };
}
int cross(Point const& lhs, Point const& rhs)
{
	return lhs.x * rhs.y - lhs.y * rhs.x;
}

vector<Point> as, cs;
int n;

bool intersect(Point& p1, Point& p2, Point& q1, Point& q2)
{
	return (
		  cross(q1 - q2, q1 - p1)
		* cross(q1 - q2, q1 - p2) <= 0
	);
}

signed main()
{
	cin >> n;
	as.resize(n);
	cs.resize(n);
	rep(i, n)
	{
		cin >> as[i].x >> as[i].y >> cs[i].x >> cs[i].y;
	}

	int m = 0;
	rep(i1, n)
	{
		repi(i2, i1 + 1, n)
		{
			rep(b1, 2)
			{
				rep(b2, 2)
				{
					auto& q1 = (b1 ? as[i1] : cs[i1]);
					auto& q2 = (b2 ? as[i2] : cs[i2]);
					int cnt = 2;
					rep(i, n)
					{
						if ( i == i1 || i ==  i2 ) continue;
						if ( intersect(as[i], cs[i], q1, q2) ) { cnt++; }
					}
					m = max(m, cnt);
				}
			}
		}
	}
	cout << m << endl;
	return 0;
}
0