結果
問題 | No.245 貫け! |
ユーザー | tubo28 |
提出日時 | 2015-06-13 00:48:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 3,295 bytes |
コンパイル時間 | 1,157 ms |
コンパイル使用メモリ | 164,724 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 15:57:33 |
合計ジャッジ時間 | 2,165 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; //#define int ll //#define endl "\n" typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i<ll(b); i++) #define rep(i,b) loop(i,0,b) #define pb push_back #define eb emplace_back #define mp make_pair #define mt make_tuple template<class T> ostream & operator<<(ostream & os, vector<T> const &); template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){} template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); } template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; } template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; } template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl) #else #define dump(...) #endif // ll const mod = 1000000007; // ll const inf = 1LL<<60; typedef long double Real; typedef complex<Real> Point; #define X real() #define Y imag() const Real EPS = 1e-10; const Real INF = 1e100; const Real PI = acos(-1); struct Segment { Point p[2]; Segment (Point a = Point(), Point b = Point()){ p[0] = a, p[1] = b; } Point & operator [] (int k) { return p[k]; } Point const & operator [] (int k) const { return p[k]; } }; struct Line { Point p[2]; Line (Point a = Point(), Point b = Point()){ p[0] = a, p[1] = b; } Point & operator [] (int k) { return p[k]; } Point const & operator [] (int k) const { return p[k]; } }; Real dot(Point a, Point b){ return a.X*b.X + a.Y*b.Y; } Real cross(Point a, Point b){ return a.X*b.Y - a.Y*b.X; } enum { LEFT = 1, RIGHT = -1, BACK = 2, FRONT = -2, ON = 0 }; int ccw(Point p, Point q, Point r){ Point a = q-p, b = r-p; if(cross(a,b) > EPS) return LEFT; if(cross(a,b) < -EPS) return RIGHT; if(dot(a,b) < -EPS) return BACK; if(norm(a) < norm(b)) return FRONT; return ON; } bool iLS(Line const & l, Segment const & s){ int a = ccw(l[0], l[1], s[0]); int b = ccw(l[0], l[1], s[1]); // neither LEFT-LEFT nor RIGHT-RIGHT return abs(a*b) != 1; } signed main(){ int n; cin >> n; vector<Segment> ss(n); vector<Point> ps(n*2); int x,y; rep(i,n){ cin >> x >> y; ss[i][0] = Point(x,y); cin >> x >> y; ss[i][1] = Point(x,y); ps[i*2] = ss[i][0]; ps[i*2+1] = ss[i][1]; } int ans = 0; rep(i,ps.size())rep(j,i){ Line l(ps[i],ps[j]); int cnt = 0; rep(i,n) cnt += iLS(l,ss[i]); ans = max(ans, cnt); } cout << ans << endl; }