Intersection http://poj.org/problem?id=1410 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17591 Accepted: 4516 Description You are to write a program that has to decide whether a given line segment intersects a given rectangle. An ex…
Intersection Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13140 Accepted: 3424 Description You are to write a program that has to decide whether a given line segment intersects a given rectangle. An example: line: start point: (4,9)…
这道题,关键在于怎么求多个区间的交集,使用multiset就可以 分别将 r , l 存在不同的mutiset中. 然后,我们来看一下 是不是 交集的 l 是最大的, 交集的 r 是最小的 #include<iostream> #include<set> #include<algorithm> using namespace std; ; multiset<int>l, r; int n, x[maxn], y[maxn], ans; int main(){…