Given n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at least one point in common. Input Input begins with a number T show
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace cutLine { unsafe public partial class Form1 : Form { ; ;
模板原型: 解决零散数点在已知线段上的出现次数.思想是将线段用长线覆盖,将长线转化成线段树.用权值记录各个数点出现的次数,最后进行查询.代码解释见注释. #include <bits/stdc++.h> using namespace std; ; int n, m, l, r; //长度n,线段数m struct line { int left, right; //left:左边界 right:右边界 int n; //该节点的权值 } a[MAXN]; void buildt(int l,