摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1052贪心,田忌的策略比较复杂,仔细想一下可过。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() {... 阅读全文
posted @ 2015-08-29 23:52 Kirai 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission... 阅读全文
posted @ 2015-08-29 23:13 Kirai 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 整理一下最近的题解,这是三个并查集的题目,分别是:POJ 1182 食物链POJ 1611 The SuspectsPOJ 2524 Ubiquitous ReligionsPOJ 1182 食物链这个题有一个很棒的套路,那就是用一个并查集来维护三个集合内的元素,可以使这个并查集扩大n倍... 阅读全文
posted @ 2015-08-29 15:55 Kirai 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2823 Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the 阅读全文
posted @ 2015-08-29 15:42 Kirai 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3974DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the s... 阅读全文
posted @ 2015-08-29 15:15 Kirai 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068最长回文Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission... 阅读全文
posted @ 2015-08-29 15:06 Kirai 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 这篇文章对Manacher介绍得很详细,而且很容易读懂,原文转自:http://blog.csdn.net/pi9nc/article/details/9251455一、问题描述现给定一个已知的字符串str[],现在想要在O(n)的时间复杂度之内求出一个最长的回文子字符串(正着和倒着顺序读一致)。M... 阅读全文
posted @ 2015-08-29 14:01 Kirai 阅读(168) 评论(0) 推荐(0) 编辑