#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX 102 struct st{ double a; double b; double c; double d; st(){ cin >> a >> b >> c >> d; } }; vector v; vector > g; int n; double func(double a, double b,double x){ return a*x + b; } bool inclu(double a,double b,double c,double d){ if (b < c || d < a){ return false; } return true; } pair calc(double a, double b, double c,double d){ double k = d - b; k /= (c - a); double N = k*-a; N += b; return make_pair(k, N); } int main(){ scanf("%d", &n); for (int i = 0; i < n; i++){ v.push_back(st()); } for (int i = 0; i < v.size(); i++){ g.push_back(make_pair(v[i].a,v[i].b)); g.push_back(make_pair(v[i].c, v[i].d)); } sort(g.begin(), g.end()); g.erase(unique(g.begin(), g.end()), g.end()); int maxt = 0; for (int i = 0; i < g.size(); i++){ for (int j = i + 1; j < g.size(); j++){ if (g[i].first == g[j].first){ int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (min(v[ii].c,v[ii].a) <= g[i].first&&g[i].first <= max(v[ii].a,v[ii].c)){ countt++; } } maxt = max(maxt, countt); continue; } if (g[i].second == g[j].second){ int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (min(v[ii].b, v[ii].d) <= g[i].second&&g[i].second <= max(v[ii].b, v[ii].d)){ countt++; } } maxt = max(maxt, countt); continue; } double k = g[j].second - g[i].second; double s = g[j].first - g[i].first; k /= s; double N = k*-g[j].first; N += g[j].second; //y=kX+N int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (v[ii].a == v[ii].c){ double x1 = func(k, N, v[ii].a); if (min(v[ii].b, v[ii].d) <= x1&&x1 <= max(v[ii].b, v[ii].d)){ countt++; } } else{ double node_k = calc(v[ii].a, v[ii].b, v[ii].c, v[ii].d).first; double node_n = calc(v[ii].a, v[ii].b, v[ii].c, v[ii].d).second; //node_kX+node_n=kX+n //node_kX-kX=n-node_n double lef = node_k - k; double rig = N - node_n; rig /= lef; //x=rig double x = rig; double y = func(node_k, node_n, x); if (node_k == 0){ if (v[ii].b <= node_n&&node_n <= v[ii].d){ countt++; } continue; } if (min(v[ii].b, v[ii].d) <= y&&y <= max(v[ii].b, v[ii].d)&&min(v[ii].a,v[ii].c)<=x&&x<=max(v[ii].a,v[ii].b)){ countt++; } } } maxt = max(maxt, countt); } } cout << maxt << endl; return 0; }