poj 1177 Picture 线段树加扫描线
来源:互联网 发布:大津算法 matlab 编辑:程序博客网 时间:2024/06/09 23:38
求矩形周长的并
之前做过一个求矩形面积并的题目
用到了扫描线这种思想
这个题目可以照搬,作两次扫描线,一次x轴,一次y轴,同样标记入边,出边,当边是最外面的边时
周长就加上这条边的长度的两倍,入边标志为1,出边为-1,当加入边之后count==0,则表明了这条边是最外面的边。
看了解题报告,做法比较高效,一次扫描线就可以。下回再看。
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define ls t<<1
#define rs t<<1|1
#define midt(tr[t].l+tr[t].r)>>1
using namespace std;
const int maxn=5011;
int x[maxn*2],y[maxn*2];
int ans;
struct no
{
}f[maxn*2];
struct node
{
}g[maxn*2];
struct
{
}tr[maxn*8];
int maketree(int t,int l,int r,int d[])
{
}
int pushdown(int t)
{
}
int modify(int t,int low,int high,int txt,int d[])
{
}
int main()
{
}
- poj 1177 Picture 线段树加扫描线
- poj 1177 Picture(线段树+离散化+…
- ACM: 线段树 poj 1177
- poj 3321 Apple Tree 线段树
- poj 2182 Lost Cows 线段树
- 【线段树】 POJ 2828 Buy Tickets
- ACM: 线段树 poj 2777 继续熟练线…
- poj 2352 Stars 线段树
- poj 3667 hotel 线段树…
- poj 3264 Balanced Lineup(线段树)
- poj 3368 Frequent values(线段树)
- poj 2892 Tunnel Warfare(线段树…
- poj 2828 Buy Tickets(线段树)
- poj 1151 Atlantis (线段树+离散+…
- ACM: 线段树 poj 2352
- ACM: 线段树 poj 3468
- ACM: 线段树 poj 3277
- ACM: 线段树 poj 3264
- 我的VIM配置(ubuntu)
- poj 2482 Stars in Your Window 线段树
- poj 2182 Lost Cows 线段树
- poj 3264 Balanced Lineup 基础线段树
- EBS R12中重新enable失效用户之后,丢失职责
- poj 1177 Picture 线段树加扫描线
- 客户端脚本验证码总结
- poj 2104 K-th Num…
- poj 3468 A Simple…
- poj 1823 Hotel 线段树
- poj 3667 hotel 线段树…
- poj 3277 City Horizon 线段树
- PHP语言实现验证码
- 一点点感想