Your browser does not support the audio element.

随笔分类 -  算法-线段树和树状数组

摘要:1809: Parenthesis Time Limit: 5 Sec Memory Limit: 128 Mb Submitted: 2291 Solved: 622 Description Bobo has a balanced parenthesis sequence P=p1 p2…pn o 阅读全文
posted @ 2017-08-14 10:06 happy_codes 阅读(479) 评论(0) 推荐(0)
摘要:1878: [SDOI2009]HH的项链 Description HH有一串由各种漂亮的贝壳组成的项链。HH相信不同的贝壳会带来好运,所以每次散步 完后,他都会随意取出一 段贝壳,思考它们所表达的含义。HH不断地收集新的贝壳,因此他的项链变得越来越长。有一天,他突然提出了一 个问题:某一段贝壳中, 阅读全文
posted @ 2017-08-03 22:07 happy_codes 阅读(192) 评论(0) 推荐(0)
摘要:【bzoj1452】[JSOI2009]Count Description Input Output Sample Input Sample Output 12 HINT 题解:对于每一个颜色建一个二维的树状数组O(c*logn*logm),试了试对每个颜色,每行建一个一维数组,超时了。。。O(c* 阅读全文
posted @ 2017-04-03 18:30 happy_codes 阅读(168) 评论(0) 推荐(0)
摘要:看到树状数组后觉得这个数据结构很优美,比较有意思,虽然很多时候线段树能做,但树状数组内存消耗更小,思想也很有意思,就想记录一下 看上去是比较漂亮的,A[] 是序列的实际数值, C[] 记录的是某一段A[]的和,例如 C[4]就是 sun(1--4)。 先介绍个很关键的函数:int lowbit(in 阅读全文
posted @ 2017-04-01 20:12 happy_codes 阅读(146) 评论(0) 推荐(0)
摘要:Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 29310 Accepted Submission(s): 14492 P 阅读全文
posted @ 2016-11-21 21:53 happy_codes 阅读(320) 评论(0) 推荐(0)
摘要:花神游历各国 Description Input Output 每次x=1时,每行一个整数,表示这次旅行的开心度 每次x=1时,每行一个整数,表示这次旅行的开心度 Sample Input 4 1 100 5 5 5 1 1 2 2 1 2 1 1 2 2 2 3 1 1 4 Sample Outp 阅读全文
posted @ 2016-10-30 21:21 happy_codes 阅读(118) 评论(0) 推荐(0)
摘要:RMQ with Shifts Time Limit:1000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64u Practice NBUT 1113 RMQ with Shifts Practice NBUT 1113 Description 阅读全文
posted @ 2016-08-17 21:41 happy_codes 阅读(223) 评论(0) 推荐(0)
摘要:Problem_A Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Problem_A Description 度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了, 阅读全文
posted @ 2016-08-05 18:25 happy_codes 阅读(232) 评论(0) 推荐(0)
摘要:F - A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu F - A Simple Problem with Integers Time Limit:5 阅读全文
posted @ 2016-07-21 16:52 happy_codes 阅读(186) 评论(0) 推荐(0)
摘要:E - I Hate It Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u E - I Hate It Time Limit:3000MS Memory Limit:32768KB 64bit IO Forma 阅读全文
posted @ 2016-07-18 20:48 happy_codes 阅读(233) 评论(0) 推荐(0)