DAG嵌套模型,状态方程由1改成高度就行。 1 #include 2 #include 3 #include 4 #define doumax(a,b) (a>b?a:b) 5 const int maxn=100; 6 int mat[maxn][maxn],dp[maxn],n,a[35][5]...
分类:
其他好文 时间:
2014-07-19 15:04:56
阅读次数:
234
Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:26876Accepted:9271DescriptionAn ascending sorted sequence of distinct values i...
分类:
其他好文 时间:
2014-07-19 15:03:58
阅读次数:
278
题目地址:ZOJ 3348
仍然是一道竞赛问题的网络流问题,但是这道题再用上次的竞赛建图方法就不行了,5000场比赛,明显会超时,于是需要换种建图思路了。上一道经典竞赛问题戳这里
上一道的胜负转换是利用专门给比赛建一个点,通过对比赛双方的流向来控制胜负关系,这里的建图方法更加巧妙(膜拜想出这个方法的大牛。。。),是先假设其中一方获胜,用mp[a][b]来表示a赢b的次数,将a与b连边,权值为m...
分类:
其他好文 时间:
2014-07-19 13:11:19
阅读次数:
289
JugsTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeIn the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with t...
分类:
其他好文 时间:
2014-07-19 12:12:58
阅读次数:
239
Power of Fibonacci
Time Limit: 5 Seconds Memory Limit: 65536 KB
In mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence...
分类:
其他好文 时间:
2014-07-19 11:48:45
阅读次数:
239
columns, each representing a street or a piece of wall.A blockhouse is a small castle that has four openings through which to shoot. The four openings...
分类:
Web程序 时间:
2014-07-19 11:28:06
阅读次数:
281
题意:
给你一串编码后的单词和一篇文章 问 编码前文章中出现了几个单词
思路:
根据题意反编码 然后AC自动机跑一下
转化字符时候注意长度 因为可能转换出'\0' 所以转完后再求strlen会出错
注意 ZOJ的char默认是signed char 所以转码后要么存在unsigned char数组里 要么用int数组存 否则会错的!! 因为signed char无法表示128+的数字!!...
分类:
其他好文 时间:
2014-07-19 02:26:26
阅读次数:
236
题意:给出n条y=ai*x+bi的直线。对于这些直线,如果存在x使得该直线y大于其他任意一直线,那么这条直线可以被看见,问有多少条直线可以被看见。做法什么的不讲了,参见:http://blog.csdn.net/ten_three/article/details/12289427 以及 http:/...
分类:
其他好文 时间:
2014-07-18 15:19:12
阅读次数:
413
写这个就是为了手写一份好用的求割点模板:
吐槽下,题目中的 Each of the next at most N lines contains the number of a place followed by the numbers of some places to which there is a direct line from this place. 这个at most是不可信的,应...
分类:
其他好文 时间:
2014-07-18 11:29:34
阅读次数:
232
最短路+DP(个人用的SPFA+完全背包)
做了一上午……开始想用SPFA+BFS。但是写了半天越写越乱,放弃了。
就想到了是不是可以当作背包问题(背出病了……)把鞋子可以使用的次数当作背包容量。做完全背包。
先N次SPFA把 各点的最短距离算出来,其实比较适合Floyd。(个人用vector实现伪邻接表,然后SPFA)
然后SPFA更新路径的时候,当鞋子使用次数不...
分类:
其他好文 时间:
2014-07-18 11:18:36
阅读次数:
279