Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
  3.  
  4. typedef CGAL::Exact_predicates_exact_constructions_kernel K;
  5. typedef K::Point_2 Point;
  6. typedef K::Ray_2 Ray;
  7. typedef K::Segment_2 Segment;
  8.  
  9. using namespace std;
  10.  
  11. bool oneCase(int n) {
  12.     bool intersects = false;
  13.     long long x,y, ex, ey; cin >> x >> y >> ex >> ey;
  14.     Point start(x, y), end(ex, ey);
  15.     Ray phil(start, end);
  16.     for (int i = 0; i < n; ++i) {
  17.         cin >> x >> y >> ex >> ey;
  18.         Point s(x, y), e(ex, ey);
  19.         Segment l(s, e);
  20.         if (!intersects && CGAL::do_intersect(phil, l))
  21.             intersects = true; // Need to read to the end
  22.     }
  23.     return intersects;
  24. }
  25.  
  26. int main() {
  27.     ios_base::sync_with_stdio(false);
  28.     int n; cin >> n;
  29.     while (n) {
  30.         cout << (oneCase(n) ? "yes" : "no") << endl;
  31.         cin >> n;
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement