Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
- typedef CGAL::Exact_predicates_exact_constructions_kernel K;
- typedef K::Point_2 Point;
- typedef K::Ray_2 Ray;
- typedef K::Segment_2 Segment;
- using namespace std;
- bool oneCase(int n) {
- bool intersects = false;
- long long x,y, ex, ey; cin >> x >> y >> ex >> ey;
- Point start(x, y), end(ex, ey);
- Ray phil(start, end);
- for (int i = 0; i < n; ++i) {
- cin >> x >> y >> ex >> ey;
- Point s(x, y), e(ex, ey);
- Segment l(s, e);
- if (!intersects && CGAL::do_intersect(phil, l))
- intersects = true; // Need to read to the end
- }
- return intersects;
- }
- int main() {
- ios_base::sync_with_stdio(false);
- int n; cin >> n;
- while (n) {
- cout << (oneCase(n) ? "yes" : "no") << endl;
- cin >> n;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement