#include <iostream> #include <sstream> #include <string> #include <vector> #include <list > #include <set> #include <map> #include <stack> #include <queue> #include <algorithm># include<numeric> #pragma warning (disable:4996) using std::cin;using std::cout;using std::endl;using std:: stringstream;using std::string;using std::vector;using std::list;using std::p air;using std::set;using std::multiset; Using std::map;using std::multimap;using std::stack;using std::queue;using std::p riority_queue;class Point{public: Double x, y; Point () {}point (const double &x, const double &y) {X = X;y = Y;}}; Class line{public:double A, B, c;//ax+by=cdouble x_min, X_max, y_min, y_max;//linear range line () {}line (const-point &first, C Onst point &second) {x_min = Std::min (First.x, second.x); X_max = Std::max (First.x, second.x); y_min = Std::min (first.y , second.y); Y_max = Std::max (First.y, SECOND.Y); if (first.x! = second.x)//slope-type feasible {b = 1;a =-(FIRST.Y-SECOND.Y)/(FIrst.x-second.x); c = First.y + a*first.x;} Else//k-> Infinity {b = 0;a = 1;c = First.x;}} BOOL Lineintersected (const line &line)//Linear intersection decision {Auto D = a*line.b-line.a*b;if (D) {return true;} return false;} BOOL Lineparallel (const line&line)//Determines whether two straight lines are parallel {auto D = a*line.b-line.a*b;if (! D) {return true;} return false;} BOOL Lineoverlapped (const Line&line)//Determine whether the two lines coincide (parallel exception) {Auto D = A*line.b-line.a*b;auto Dx = C*line.b-line.c*b;auto Dy = A*line.c-line.a*c;if (! d&&! dx&&! Dy) {return true;} return false;} Point getintersection (const line&line)//determinant two-line intersection {Auto D = A*line.b-line.a*b;auto Dx = C*line.b-line.c*b;auto Dy = a*line.c-line.a*c;return{dx/d,dy/d};} BOOL Segmentintersected (const line &line) {if (lineintersected (line)) {Auto point = getintersection (line); Point.x >= x_min&&point.x <= x_max&&point.y >= y_min&&point.y <= y_max&& Point.x >= line.x_min&&point.x <= line.x_max&&point.y >=Line.y_min&&point.y <= Line.y_max)//intersection in the range of two segments {return true;}} return false;} BOOL Segmentoverlapped (const line &line) {if (lineoverlapped (line)) {if (x_min <= Line.x_max | | X_max >= line.x_m In) {return true;}} return false;}}; Class Rectangle{public:int left, right, top, Bottom;bool inrectangle (const point &point) {if (Point.x >= left&& Amp;point.x <= right&&point.y >= bottom&&point.y <= top) {return true;} return false;}}; int main () {//freopen ("Input.txt", "R", stdin),//freopen ("Output.txt", "w", stdout); int n;while (CIN >> n& &n) {vector<line>line (1); for (int i = 1; I <= n; i++) {double x1, x2, y1, y2;cin >> x1 >> y1 >&G T X2 >> y2;line.push_back ({{x1,y1},{x2,y2}}); vector<bool>overlapped (n + 1), for (int i = 1, i <= N; i++) {for (int j = i+1; J <=n; J + +) {if (line[i].segmentin Tersected (Line[j]) | | Line[i].segmentoverlapped (Line[j])) {overlapped[i] = True;break;}}} cout << "Top StIcks: "; bool flag = false;for (int i = 1; I <= N; i++) {if (!overlapped[i]) {if (flag) {cout << ', ';} Flag = true;cout << ' << I;}} cout << '. ' << Endl;} return 0;}
Uva_10902_pick-up Sticks