利用叉积判断点在线段左边还是右边,然后进行二分即可
代码:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 5005;
int n, m, x1, y1, x2, y2;
struct Point {
int x, y;
Point() {}
Point(int x, int y) {
this->x = x;
this->y = y;
}
};
typedef Point Vector;
Vector operator - (Vector A, Vector B) {
return Vector(A.x - B.x, A.y - B.y);
}
struct Seg {
Point a, b;
Seg() {}
Seg(Po......
阅读全文