随笔分类 -  线段树

UVA-1400 Ray, Pass me the dishes!
摘要:UVA-1400 Ray, Pass me the dishes! 题意:给出一个长度为n的整数序列D,有m个询问,每个询问(a,b)找到两个下标x和y,使得a<=x<=y<=n,并且Dx+...+Dy尽量大。如果有多组满足条件的x和y,x应该尽量小。如果还有多解,y应该尽量小。 思路:线段树,对于 阅读全文

posted @ 2018-06-01 22:32 ZefengYao 阅读(279) 评论(0) 推荐(0)

《挑战程序设计竞赛》 利用后缀数组求最长回文串
摘要:问题:求一个字符串的最长回文子串。 解决方案:利用后缀数组,设这个字符串是S,S'是这个字符串的反转,设T=S+'$'+S',则所有的回文子串一定会出现在字符串T当中的其中两个后缀的前缀上,所以只要求T的lcp,利用lcp求后缀之间的相同前缀的最大长度。 代码参考: 阅读全文

posted @ 2018-05-29 11:05 ZefengYao 阅读(354) 评论(0) 推荐(0)

poj 2482 Stars in Your Window
摘要:Stars in Your Window Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12502 Accepted: 3428 Description Fleeting time does not blur my memory 阅读全文

posted @ 2017-09-04 19:31 ZefengYao 阅读(151) 评论(0) 推荐(0)

poj 3470 Walls
摘要:Walls Time Limit: 6000MS Memory Limit: 131072K Total Submissions: 1817 Accepted: 297 Case Time Limit: 3000MS Description There are N walls. A wall has 阅读全文

posted @ 2017-05-31 15:06 ZefengYao 阅读(565) 评论(0) 推荐(0)

poj 3368 Frequent values
摘要:Frequent values Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 18520 Accepted: 6687 Description You are given a sequence of n integers a1 阅读全文

posted @ 2017-04-12 13:27 ZefengYao 阅读(160) 评论(0) 推荐(0)

poj 3264 Balanced Lineup
摘要:Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 51876 Accepted: 24319 Case Time Limit: 2000MS Description For the daily mil 阅读全文

posted @ 2017-04-10 21:08 ZefengYao 阅读(123) 评论(0) 推荐(0)

poj 2104 K-th Number
摘要:K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 55340 Accepted: 19030 Case Time Limit: 2000MS Description You are working for 阅读全文

posted @ 2017-04-01 11:48 ZefengYao 阅读(142) 评论(0) 推荐(0)

导航