結果
問題 |
No.245 貫け!
|
ユーザー |
![]() |
提出日時 | 2015-07-18 00:45:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,677 bytes |
コンパイル時間 | 810 ms |
コンパイル使用メモリ | 81,644 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 09:54:56 |
合計ジャッジ時間 | 1,348 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 WA * 8 |
ソースコード
#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; }