[POJ 1151] Atlantis】的更多相关文章

题目原链接:http://poj.org/problem?id=1151 题目中文翻译: POJ 1151 Atlantis Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25769   Accepted: 9477 Description 有几个古希腊文本包含传说中的亚特兰蒂斯岛的描述. 其中一些文本甚至包括岛屿部分地图. 但不幸的是,这些地图描述了亚特兰蒂斯的不同区域. 您的朋友Bill必须知道地图的总面积. 你(不…
Atlantis 题目连接 http://poj.org/problem?id=1151 Description here 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 describ…
题目链接:http://poj.org/problem?id=1151 题目大意:坐标轴上给你n个矩形, 问这n个矩形覆盖的面积 题目思路:矩形面积并. 代码如下: #include<stdio.h> #include<vector> #include<algorithm> using namespace std; ; struct Line { int l, r, flag; double h; Line(){} Line(int l, int r, int flag…
题目链接:http://poj.org/problem?id=1151 题意是平面上给你n个矩形,让你求矩形的面积并. 首先学一下什么是扫描线:http://www.cnblogs.com/scau20110726/archive/2013/04/12/3016765.html 这是别人的blog,写的挺好的.然后明白扫描线之后呢,接下来就很简单了,只需要一次一次求面积然后累加就好了.这题离散化之后,数据的范围更小了(因为n只有100),单点更新就行了. #include <iostream>…
一样的题:HDU 1542 Atlantis Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18148   Accepted: 6902 Description There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include map…
Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11777    Accepted Submission(s): 4983 Problem Description There are several ancient Greek texts that contain descriptions of the fabled…
这次是求矩形面积并 /* Problem: 1151 User: 96655 Memory: 716K Time: 0MS Language: G++ Result: Accepted */ #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include…
第一次做线段树扫描法的题,网搜各种讲解,发现大多数都讲得太过简洁,不是太容易理解.所以自己打算写一个详细的.看完必会o(∩_∩)o 顾名思义,扫描法就是用一根想象中的线扫过所有矩形,在写代码的过程中,这根线很重要.方向的话,可以左右扫,也可以上下扫.方法是一样的,这里我用的是由下向上的扫描法. 如上图所示,坐标系内有两个矩形.位置分别由左下角和右上角顶点的坐标来给出.上下扫描法是对x轴建立线段树,矩形与y平行的两条边是没有用的,在这里直接去掉.如下图. 现想象有一条线从最下面的边开始依次向上扫描…
求矩阵的面积并 采用的是区间更新 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #define lson rt<<1,L,mid #define rson rt<<1|1,mid+1,R /* AC 一开始一直WA的原因是,hashx写成了int型!!! 第一次用的是直接单点更新,这次用区间更新写写看 */ using n…
题目链接题意:给定n个矩形,求面积并,分别给矩形左上角的坐标和右上角的坐标. 分析: 映射到y轴,并且记录下每个的y坐标,并对y坐标进行离散. 然后按照x从左向右扫描. #include <iostream> #include <cstdio> #include <vector> #include <cstring> #include <cstdlib> #include <algorithm> #define LL __int64…