HDU 之 City Game】的更多相关文章

F - City Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1505 Appoint description: Description Bob is a strategy game programming specialist. In his new city building game the gaming enviro…
City Planning Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 483    Accepted Submission(s): 203 Problem Description After many years, the buildings in HDU has become very old. It need to rebuil…
City Planning Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 503    Accepted Submission(s): 213 Problem Description After many years, the buildings in HDU has become very old. It need to rebui…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5013 题意: 思路: 这里有错,是Hi(x)=sigama(Hji)(j属于x) const int N=18; int m,n; double p[N],H[N][N]; double f[N][1<<N]; double dp[N][1<<N]; double a[1<<N],aa[1<<N]; double pp[1<<N],qq[1<&…
Problem Description Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees,factories and buildings. There is still some space i…
                                                                                  City Game Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description Bob is a strategy game programming specialist. In his new cit…
City Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4531    Accepted Submission(s): 1919 Problem Description Bob is a strategy game programming specialist. In his new city building game t…
这题是上一题的升级版 关键在于条形图的构造,逐行处理输入的矩阵,遇到'F'则在上一次的条形图基础上再加1,遇到'R'则置为0 然后用上一题的算法,求每行对应条形图的最大矩阵的面积. 另外:本来是debug都不用就1A的节奏.可在输入数据上,一开始我用的是scanf读入字符 和 getchar跳过无效字符,在测试数据上是没有问题的,但一交上去就WA掉了. 看到别人的代码使用cin读入的.其实,如果输入数据不太大的话,cin还是比较放心好用的. //#define LOCAL #include <i…
1506意甲冠军:给你一个连续的直方图(拼贴底部长度1).求连续基质区. 对每一个直方图,分别向左向右进行扩展. #include<cstdio> #include<stdlib.h> #include<string.h> #include<string> #include<map> #include<cmath> #include<iostream> #include <queue> #include <…
思路:逆向并查集,逆向加入每一条边即可.在获取联通块数量的时候,直接判断新加入的边是否合并了两个集合,如果合并了说明联通块会减少一个,否则不变. AC代码 #include <cstdio> #include <cmath> #include <cctype> #include <algorithm> #include <cstring> #include <utility> #include <string> #incl…
# include <stdio.h> # include <algorithm> # include <string.h> # include <iostream> using namespace std; char a[1010][1010]; int dd[1010][1010];///宽度 int r[1010],l[1010]; int main() { int t,i,j,n,m,max1; while(~scanf("%d"…
题意:是二维的1506,即在1506的基础上,再加一个for循环,即从第一行到最后一行再扫一遍--- 自己写的时候,输入的方法不对---发现输不出结果,后来看了别人的----@_@发现是将字母和空格当成一个字符串来输入的. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int h[1010][1010],l[1010…
vjudge 读进来可能会有相同的\(n_i\),不过在相同的\(n_i\)中只有最后一个是有用的,所以其他的要缩起来,缩完后这些\(n\)的数量不会超过19个 可以发现一个城市的答案为所有城市初始权值的线性组合,然后对于\(x\),其他和\(x\)gcd深度相同的点转移系数都是一样的,因为gcd深度相同那么转移也是本质相同的 那么考虑构造转移矩阵,\(a_{i,j}\)表示gcd深度为\(i\)转移到深度为\(j\)的方案数,那么答案即为\(ans_x=\sum_{i=1}^{n} d_x {…
DP 158:11:22 1205:00:00   Overview Problem Status Rank (56) Discuss Current Time: 2015-11-26 19:11:23 Contest Type: Private Start Time: 2015-11-20 05:00:00 Contest Status: Running End Time: 2016-01-09 10:00:00 Manager: qwerqqq Clone this contest Edit…
The plan of city rebuild Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 616    Accepted Submission(s): 215 Problem Description News comes!~City W will be rebuilt with the expectation to become…
题目链接: Hdu 5352 MZL's City 题目描述: 有n各节点,m个操作.刚开始的时候节点都是相互独立的,一共有三种操作: 1:把所有和x在一个连通块内的未重建过的点全部重建. 2:建立一条双向路(x,y) 3:又发生了地震,p条路被毁. 问最后最多有多少个节点被重建,输出重建节点的最小字典序. 解题思路: 这几天正好在学匹配,但是昨天下午还是没有看出来这个是匹配题目.看了题解扪心自问了自己三次,是不是傻.就是把每个需要重建的节点x拆成k个点,然后对每个拆分后的点和与拆点在同一连通块…
HDU 4849 Wow! Such City! 题目链接 题意:依照题目中的公式构造出临接矩阵后.求出1到2 - n最短路%M的最小值 思路:就依据题目中方法构造矩阵,然后写一个dijkstra,利用d数组取求答案就可以 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const long long…
学习博客推荐——线段树+扫描线(有关扫描线的理解) 我觉得要注意的几点 1 我的模板线段树的叶子节点存的都是 x[L]~x[L+1] 2 如果没有必要这个lazy 标志是可以不下传的 也就省了一个push_down 3 注意push_up 写法有点不一样,不过是可以改成一样的. 简单裸题*2 L - Atlantis  HDU - 1542 #include <iostream> #include <cstdio> #include <algorithm> #inclu…
Wow! Such City! Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 824    Accepted Submission(s): 310 Problem Description Doge, tired of being a popular image on internet, is considering moving…
Largest Rectangle in a Histogram Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17635    Accepted Submission(s): 5261   Problem Description A histogram is a polygon composed of a sequence of r…
最大01子矩阵和,就是一个矩阵的元素不是0就是1,然后求最大的子矩阵,子矩阵里的元素都是相同的. 这个题目,三个oj有不同的要求,hoj的要求是5s,poj是3秒,hdu是1秒.不同的要求就对应不同的难度,不同的逼格. 先看最low的, HOJ 1664 5秒钟的时间,够长了.我很容易想到可以最大子矩阵和来求解,二者本来就很像,关于最大子矩阵和这个博客里有介绍 最大子矩阵和 这里我们可以把F变成1,把R变成负无穷大,这样求解最大子矩阵和就可以得到答案 #include <iostream> #…
http://acm.hdu.edu.cn/showproblem.php?pid=4849 会有非常多奇怪的Wa的题.当初在西安就不知道为什么wa,昨晚做了,由于一些Sb错误也wa了非常久.这会儿怎么写都会AC. ... 收获: 1.还是基本都构思好在去写程序,由于当时没过.昨晚心里有阴影.敲得非常慢,并且最開始各种取模以防止漏掉,太保守了......以后一定先估算是不是须要取模防止TLE,当然时间够的话还是适当多取个模防止莫名其妙的错误.. 2.假设出错,注意參数是不是对的,最開始写好之后.…
题意  一个城市原来有l个村庄 e1条道路  又添加了n个村庄 e2条道路  后来后销毁了m个村庄  与m相连的道路也销毁了  求使全部未销毁村庄相互连通最小花费  不能连通输出what a pity! 还是非常裸的最小生成树  把销毁掉的标记下  然后prim咯  结果是无穷大就是不能连通的 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N =…
MZL's City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 710    Accepted Submission(s): 245 Problem Description MZL is an active girl who has her own country. Her big country has N cities numb…
MZL's City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 743    Accepted Submission(s): 260 Problem Description MZL is an active girl who has her own country. Her big country has N cities numb…
Country A and B are at war. Country A needs to organize transport teams to deliver supplies toward some command center cities. In order to ensure the delivery works efficiently, all the roads in country A work only one direction. Therefore, map of co…
做这题之前建议做一下hdu1506题,两道题是极度相似的题,不同的是这个要处理的是m行,所以可以用一个dp[][]数组存储矩形的高度,之后就变成hdu1506了. 例如测试样例: 0 1 1 1 1 1                                               0 1 1 1 1 1 1 1 1 1 1 1           (F=1,R=0,方便求和)       1 2 2 2 2 2 0 0 0 1 1 1           转化完就是右边矩阵    …
题意:一张相片上的很多建筑相互遮住了,根据高低不同就在相片上把一座高楼的可见部分作为一个矩形,并用数字描述其高度,若一张相片上的两个建筑群中间有空地,高度则为0;求最少有多少个建筑; 分析: 输入的0不是建筑,则输入的总个数减去0的个数就是最多可能有的建筑数;再从第一个开始从前往后搜,若发现比它高的则继续搜,若发现比它低的则说明它是一个独立的建筑,这时可以返回搜其它的;若与它相等,说明这时它们还没有出现比它们低的建筑,则视其为同一个建筑,则ans减1; #include<cstdio> #in…
最小费用最大流,因为要控制字典序,网络流控制不好了...一直WA,所以用了费用流,时间早的费用大,时间晚的费用少. 构图: 建立一个超级源点和超级汇点.超级源点连向1操作,容量为K,费用为COST,然后COST-1,因为下一次遇到1操作,费用为减少1,即COST-1: 每个1操作连向当前能建造的城市,容量为1,费用为0: 每个城市连向汇点,容量为1,费用为0: #include<cstdio> #include<cstring> #include<cmath> #inc…
Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)   Input There are several test cases. Please process till EOF.For each test case, there is only one line containing 6 integers N,M,X0,X1,Y0,Y1.See the description for…