线段树
文章平均质量分 91
yerkeys
小小程序猿
展开
-
POJ 1151 Atlantis 线段树+离散化+扫描线
Description There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps ...原创 2019-01-12 19:30:14 · 233 阅读 · 1 评论 -
POJ 2528 Mayor's posters 线段树+离散化
Mayor's posters Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. ...原创 2018-02-17 16:58:52 · 195 阅读 · 0 评论 -
POJ 2182 Lost Cows 线段树
Lost Cows Description N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few to...原创 2018-02-14 17:39:37 · 178 阅读 · 0 评论 -
线段树
线段树用于对数据的更新和查询,主要优势体现在对段的处理上。如将数组a[]从a[i]-a[j]的元素均加上b,要做j-i+1次,而有一个段表示a[i]-a[j]的话,就直接将这个段的和sum加上b*(j-i+1)即可。同理,查询段的和也只需一次。 线段树的原理就是将[1,n]分解成若干子区间,通过对其少量子区间进行修改统计实现对该区间快速的修改统计,用于统计的对象需符合区间加法,如求和,求最值,公...原创 2018-02-13 23:03:16 · 132 阅读 · 0 评论 -
POJ2482 Stars in Your Window
Description (一段令人感动的程序员的爱情故事...) Here comes the problem: Assume the sky is a flat plane. All the stars lie on it with a location (x, y). for each star, there is a grade ranging from 1 to 100, rep...原创 2019-01-31 22:24:58 · 225 阅读 · 0 评论