随笔分类 -  思维

摘要:Atlantis Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24566 Accepted: 9116 Description There are several ancient Greek texts that contai 阅读全文
posted @ 2018-03-22 23:58 litos 阅读(134) 评论(0) 推荐(0)
摘要:There is a pile of N books on the table. Two types of operations are performed over this pile: - a book is added to the top of the pile, - top K books 阅读全文
posted @ 2018-03-18 20:07 litos 阅读(250) 评论(0) 推荐(0)
摘要:The lazy programmer Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 2785 Accepted: 703 Description A new web-design studio, called SMART (S 阅读全文
posted @ 2018-03-18 16:56 litos 阅读(172) 评论(0) 推荐(0)
摘要:在过三个礼拜,YellowStar有一场专业英语考试,因此它必须着手开始复习。 这天,YellowStar准备了n个需要背的单词,每个单词的长度均为m。 YellowSatr准备采用联想记忆法来背诵这n个单词: 1、如果YellowStar凭空背下一个新词T,需要消耗单词长度m的精力 2、如果Yel 阅读全文
posted @ 2018-03-18 14:07 litos 阅读(190) 评论(0) 推荐(0)
摘要:Feel Good Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 16786 Accepted: 4627 Case Time Limit: 1000MS Special Judge Description Bill is de 阅读全文
posted @ 2018-03-18 10:55 litos 阅读(156) 评论(0) 推荐(0)
摘要:D. Closest Equals time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output D. Closest Equals time 阅读全文
posted @ 2018-03-14 21:32 litos 阅读(332) 评论(0) 推荐(0)
摘要:Fliping game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2129 Accepted Submission(s): 1427 Pr 阅读全文
posted @ 2018-03-13 23:18 litos 阅读(168) 评论(0) 推荐(0)
摘要:0 or 1 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2811 Accepted Submission(s): 914 Problem D 阅读全文
posted @ 2018-03-13 21:47 litos 阅读(195) 评论(0) 推荐(0)
摘要:A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A. Masha and Bears ti 阅读全文
posted @ 2018-03-12 23:55 litos 阅读(257) 评论(0) 推荐(0)
摘要:A. Nephren gives a riddle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A. Nephren giv 阅读全文
posted @ 2018-03-12 19:44 litos 阅读(268) 评论(0) 推荐(0)
摘要:Problem 1989 AntiAC Accept: 93 Submit: 444Time Limit: 4000 mSec Memory Limit : 32768 KB Accept: 93 Submit: 444Time Limit: 4000 mSec Memory Limit : 327 阅读全文
posted @ 2018-03-10 11:16 litos 阅读(150) 评论(0) 推荐(0)
摘要:原题链接 题意 给你n个序列以及序列内元素个数,现要求进行归并,花费为归并过程中序列长度的和,给定一个花费T,问最小的k(每次归并的最大序列个数)为多少。 分析 首先应该想到的是二分。然后思考如何check呢。排序,贪心的来,每次都选最小的前若干个。要注意的是,最后k-1个当然是在最后一次归并,那么 阅读全文
posted @ 2017-08-28 01:40 litos 阅读(148) 评论(0) 推荐(0)
摘要:题目链接 参考 http://blog.csdn.net/KIJamesQi/article/details/52214990 题意 蛤蛤要从这岸去到对岸,河中有n块石头,现可以在河中添加一块石头,使得在单步跳跃中的最大值最小。 分析 dijkstra应用。开两维来表示路径中是否使用过额外的石头。d 阅读全文
posted @ 2017-08-12 22:35 litos 阅读(242) 评论(0) 推荐(0)
摘要:题目链接 参考 题意 N*M的网格,一辆车沿着网格线按给定路线走,每个网格里有一个人,人的视线始终看着车,问这些人净转圈数的平方和。 分析 由于车的起点和终点都为左上角,且每个格子里的人永远面对着车,经过多次模拟可发现:每个人的圈数与其所在格子左边向下次数与向上次数的差。于是只需要维护这个次数,对每 阅读全文
posted @ 2017-08-11 13:16 litos 阅读(240) 评论(0) 推荐(0)
摘要:原题链接 题意 给两个等长的只含数字1,2,3,4,5,6的字符串s(|s|≤110),有两种操作: - 把一个位置的数字换成另一个数字,换成的数字也只能是1到6- 把这个字符串中相同的数字都换成另一种数字应用上面的两种操作把第二个字符串转换成第一个字符串至少需要多少次操作? 分析首先尽可能多的进行 阅读全文
posted @ 2017-08-10 01:26 litos 阅读(516) 评论(0) 推荐(0)
摘要:题目链接 题意 给出一个序列,相邻两两异或,生成一个新序列,再相邻两两异或,直到只剩下一个元素,问最后结果为多少。m个查询,每次都有一个待查询区间。 分析 既然有多组查询,n只是1e4,那么可以考虑预处理。预处理出每种长度的区间最后剩下的元素位置。然后就O(1)查询了。 阅读全文
posted @ 2017-08-04 15:22 litos 阅读(230) 评论(0) 推荐(0)
摘要:原题链接 题意:给出一个打乱顺序的序列,问是否能构造出一个括号匹配的字符串。每个数字为此前读取到的左括号数减去右括号数。 分析:有左括号开始构造,不够的话就找右括号。注意特殊情况待处理。详情看代码 阅读全文
posted @ 2017-08-03 22:52 litos 阅读(203) 评论(0) 推荐(0)
摘要:题目链接 题意:n个数m个查询,问[l,r]中的数是否为1到r-l+1的一个排列。 做法1:hash一下,对于[1...n],每个数都随机分配一个hash值,一个集合的hash值为元素异或和。预处理出[1...n]的hash值及其前缀的hash,然后就可以O(1)查询了 做法二:线段树若(l,r)中 阅读全文
posted @ 2017-07-29 21:13 litos 阅读(244) 评论(0) 推荐(0)