- 博客(87)
- 资源 (3)
- 收藏
- 关注
原创 HDU - 4552 怪盗基德的挑战书 (后缀数组)
Description “在树最美丽的那天,当时间老人再次把大钟平均分开时,我会降临在灯火之城的金字塔前,带走那最珍贵的笑容。”这是怪盗基德盗取巴黎卢浮宫的《蒙娜丽莎的微笑》这幅画时,挑战书上的内容。 但这次,怪盗基德的挑战书上出现了一串串小写字母“aaab sdfeeddd...”。柯南以小学生的眼睛,超凡高中生的头脑,快速统计各种字母频率,字符串长度,并结合挑战书出现的时间等
2014-09-30 22:07:16 954
原创 POJ - 3294 Life Forms
DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear n
2014-09-30 14:32:18 915
原创 POJ - 3415 Common Substrings(后缀数组求长度不小于 k 的公共子串的个数+单调栈优化)
DescriptionA substring of a string T is defined as:T( i, k)= TiTi+1... Ti+k-1, 1≤ i≤ i+k-1≤| T|.Given two strings A, B and one integer K, we define S, a set of triples (i, j, k):S =
2014-09-29 11:22:39 1418
原创 POJ - 3693 Maximum repetition substring(后缀数组求重复次数最多的连续重复子串)
DescriptionThe repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of
2014-09-28 15:44:22 963
原创 Codeforces Round #269 (Div. 2)
Two polar bears Menshykov and Uslada from the St.Petersburg zoo and elephant Horace from the Kiev zoo got six sticks to play with and assess the animals' creativity. Menshykov, Uslada and Horace decid
2014-09-28 09:36:03 1006
原创 HDU - 5047 Sawtooth
Problem DescriptionThink about a plane:● One straight line can divide a plane into two regions.● Two lines can divide a plane into at most four regions.● Three lines can divide a plane int
2014-09-27 23:07:05 1313
原创 HDU - 5050 Divided Land
Problem DescriptionIt’s time to fight the local despots and redistribute the land. There is a rectangular piece of land granted from the government, whose length and width are both in binary form.
2014-09-27 22:58:29 1431
原创 HDU - 5053 the Sum of Cube
Problem DescriptionA range is given, the begin and the end are both integers. You should sum the cube of all the integers in the range. InputThe first line of the input is T(1 Each
2014-09-27 22:53:52 985
原创 HDU - 5045 Contest(DP+状压)
Problem DescriptionIn the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems.
2014-09-27 21:00:22 1127
原创 URAL - 1297 Palindrome(后缀数组求最长回文子串)
DescriptionThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. R
2014-09-26 21:05:45 1195
原创 SPOJ - DISUBSTR Distinct Substrings(后缀数组求不相同的子串个数)
DescriptionGiven a string, we need to find the total number of its distinct substrings.InputT- number of test cases. TEach test case consists of one string, whose length is OutputFor eac
2014-09-26 19:03:21 1380
原创 POJ - 3261 Milk Patterns (后缀数组求可重叠的 k 次最长重复子串)
DescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of milk f
2014-09-26 16:23:26 975
原创 POJ - 1743 Musical Theme (后缀数组求不可重叠最长重复子串)
DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this
2014-09-25 20:55:54 1893
原创 HDU - 2457 DNA repair
DescriptionBiologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, a DNA is represented as a string containing
2014-09-24 22:43:30 1684
原创 HDU - 3065 病毒侵袭持续中
Description小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:包含多少不同的病
2014-09-24 16:43:09 916
原创 HDU - 2222 Keywords Search (AC自动机)
DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system. Every image have a
2014-09-24 15:52:52 902
转载 AC自动机算法详解
首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有模式树(字典树)Trie和KMP模式匹配算法的基础知识。AC自动机算法分为3步:构造一棵Trie树,构造失败指针和模式匹配过程。
2014-09-24 10:28:37 636
原创 HDU - 4514 湫湫系列故事――设计风景线
Description 随着杭州西湖的知名度的进一步提升,园林规划专家湫湫希望设计出一条新的经典观光线路,根据老板马小腾的指示,新的风景线最好能建成环形,如果没有条件建成环形,那就建的越长越好。 现在已经勘探确定了n个位置可以用来建设,在它们之间也勘探确定了m条可以设计的路线以及他们的长度。请问是否能够建成环形的风景线?如果不能,风景线最长能够达到多少? 其中,可以兴
2014-09-23 20:35:27 920
原创 HDU - 4521 小明系列问题――小明序列 (存在间隔的LIS)
Description 大家都知道小明最喜欢研究跟序列有关的问题了,可是也就因为这样,小明几乎已经玩遍各种序列问题了。可怜的小明苦苦地在各大网站上寻找着新的序列问题,可是找来找去都是自己早已研究过的序列。小明想既然找不到,那就自己来发明一个新的序列问题吧!小明想啊想,终于想出了一个新的序列问题,他欣喜若狂,因为是自己想出来的,于是将其新序列问题命名为“小明序列”。 提起小明
2014-09-23 16:45:12 820
原创 HDU - 4526 威威猫系列故事――拼车记 (DP)
Description 话说威威猫有一次去参加比赛,虽然学校离比赛地点不太远,但威威猫还是想坐出租车去。大学城的出租车总是比较另类,有“拼车”一说,也就是说,你一个人坐车去,还是一堆人一起,总共需要支付的钱是一样的(每辆出租上除司机外最多坐下4个人)。刚好那天同校的一群Acmer在校门口扎堆了,大家果断决定拼车去赛场。 问题来了,一辆又一辆的出租车经过,但里面要么坐满了乘客,要
2014-09-22 20:51:50 1273
原创 HDU - 4529 郑厂长系列故事――N骑士问题 (状态压缩DP)
Description 郑厂长不是正厂长 也不是副厂长 他根本就不是厂长 还是那个腾讯公司的码农 一个业余时间喜欢下棋的码农 最近,郑厂长对八皇后问题很感兴趣,拿着国际象棋研究了好几天,终于研究透了。兴奋之余,坐在棋盘前的他又开始无聊了。无意间,他看见眼前的棋盘上只摆了八个皇后,感觉空荡荡的,恰好又发现身边还有几个骑士,于是,他想把这些骑
2014-09-22 10:12:04 1215
原创 HDU - 5038 Grade
Problem DescriptionTed is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mu
2014-09-21 23:11:56 1358
原创 HDU - 5033 Building
Problem DescriptionOnce upon a time Matt went to a small town. The town was so small and narrow that he can regard the town as a pivot. There were some skyscrapers in the town, each located at posit
2014-09-21 20:25:00 1922
原创 HDU - 1565 方格取数(1) (DP)
Description给你一个n*n的格子的棋盘,每个格子里面有一个非负数。 从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大。 Input包括多个测试实例,每个测试实例包括一个整数n 和n*n个非负数(n Output对于每个测试实例,输出可能取得的最大的和
2014-09-20 22:01:16 1066
原创 HDU - 5025 Saving Tang Monk
Problem Description《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written by Wu Cheng'en during the Ming Dynasty. In this novel, Monkey
2014-09-20 20:46:05 2357
原创 HDU - 5024 Wang Xifeng's Little Plot
Problem Description《Dream of the Red Chamber》(also 《The Story of the Stone》) is one of the Four Great Classical Novels of Chinese literature, and it is commonly regarded as the best one. This novel
2014-09-20 20:40:25 1424
原创 HDU - 5023 A Corrupt Mayor's Performance Art(区间修改)
Problem DescriptionCorrupt governors always find ways to get dirty money. Paint something, then sell the worthless painting at a high price to someone who wants to bribe him/her on an auction, this
2014-09-20 20:38:05 1029
原创 Codeforces Round #267 (Div. 2) C. George and Job
The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following pro
2014-09-19 23:35:56 1246
原创 LightOJ - 1422 Halloween Costumes (区间DP)
DescriptionGappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all cos
2014-09-19 10:56:13 1180
原创 Codeforces Round #267 (Div. 2) B. Fedor and New Game
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».The game has (m + 1) players and n types of soldiers in
2014-09-19 10:23:21 1530
原创 Codeforces Round #267 (Div. 2) A. George and Accommodation
George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.George and
2014-09-19 09:15:38 1270
原创 ZOJ - 3537 Cake (凸包+区间DP+最优三角剖分)
DescriptionYou want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The t
2014-09-18 23:31:58 1801
原创 Codeforces Round #265 (Div. 2) D. Restore Cube
Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parall
2014-09-18 15:08:35 1148 2
原创 Codeforces Round #265 (Div. 2) C. No to Palindromes!
Paul hates palindromes. He assumes that strings is tolerable if each its character is one of the firstp letters of the English alphabet and s doesn't contain any palindrome contiguous substring
2014-09-17 17:04:43 1329 1
原创 Codeforces Round #265 (Div. 2) B. Inbox (100500)
Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread.Alexey's mail program can either show a list of all letters or show the content of a s
2014-09-17 14:36:34 1574
原创 HDU - 2328 Corporate Identity
DescriptionBeside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Inter
2014-09-16 19:12:23 1906
原创 Codeforces Round #265 (Div. 2) A. inc ARG
Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting ofn bits. These bits are numbered from 1 to n. An integer is stored in the cell in
2014-09-16 16:25:39 992
原创 Codeforces Round #266 (Div. 2) D. Increase Sequence
Peter has a sequence of integers a1, a2, ..., an. Peter wants all numbers in the sequence to equalh. He can perform the operation of "adding one on the segment[l, r]": add one to all elements of t
2014-09-16 13:19:51 1523 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人