06 2013 档案

【原创】AC自动机小结
摘要:有了KMP和Trie的基础,就可以学习神奇的AC自动机了。AC自动机其实就是在Trie树上实现KMP,可以完成多模式串的匹配。 AC自动机 其实 就是创建了一个状态的转移图,思想很重要。 推荐的学习链接:http://acm.uestc.edu.cn/bbs/read.php?tid=4294http://blog.csdn.net/niushuai666/article/details/7002823http://hi.baidu.com/nialv7/item/ce1ce015d44a6ba7feded52d AC自动机专题训练链接:http://acm.h... 阅读全文

posted @ 2013-06-30 23:16 kuangbin 阅读(30872) 评论(5) 推荐(8)

ZOJ 3494 BCD Code(AC自动机+数位DP)
摘要:BCD CodeTime Limit:5 Seconds Memory Limit:65536 KBBinary-coded decimal (BCD) is an encoding for decimal numbers in which each digit is represented by its own binary sequence. To encode a decimal number using the common BCD encoding, each decimal digit is stored in a 4-bit nibble:Decimal: 0 1 ... 阅读全文

posted @ 2013-06-30 22:29 kuangbin 阅读(2527) 评论(0) 推荐(0)

HDU 3341 Lost's revenge(AC自动机+DP)
摘要:Lost's revengeTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 2262Accepted Submission(s): 565Problem DescriptionLost and AekdyCoin are friends. They always play "number game"(A boring game based on number theory) together. We all kno 阅读全文

posted @ 2013-06-30 16:25 kuangbin 阅读(1627) 评论(0) 推荐(0)

HDU 2425 DNA repair (AC自动机+DP)
摘要:DNA repairTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 940Accepted Submission(s): 500Problem DescriptionBiologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, 阅读全文

posted @ 2013-06-29 22:14 kuangbin 阅读(655) 评论(0) 推荐(0)

HDU 2296 Ring (AC自动机+DP)
摘要:RingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1564Accepted Submission(s): 487Problem DescriptionFor the hope of a forever love, Steven is planning to send a ring to Jane with a romantic string engraved on. The string's length should not e 阅读全文

posted @ 2013-06-29 21:12 kuangbin 阅读(682) 评论(0) 推荐(0)

POJ 1625 Censored!(AC自动机+DP+高精度)
摘要:Censored!Time Limit:5000MSMemory Limit:10000KTotal Submissions:6956Accepted:1887DescriptionThe alphabet of Freeland consists of exactly N letters. Each sentence of Freeland language (also known as Freish) consists of exactly M letters without word breaks. So, there exist exactly N^M different Freish 阅读全文

posted @ 2013-06-27 22:41 kuangbin 阅读(1779) 评论(3) 推荐(0)

HDU 2243 考研路茫茫——单词情结(AC自动机+矩阵)
摘要:考研路茫茫——单词情结Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2687Accepted Submission(s): 744Problem Description背单词,始终是复习英语的重要环节。在荒废了3年大学生涯后,Lele也终于要开始背单词了。一天,Lele在某本单词书上看到了一个根据词根来背单词的方法。比如"ab",放在单词前一般表示"相反,变坏,离去"等。于是Lele想,如果背了N个词根 阅读全文

posted @ 2013-06-27 18:35 kuangbin 阅读(3511) 评论(3) 推荐(0)

POJ 2778 DNA Sequence(AC自动机+矩阵加速)
摘要:DNA SequenceTime Limit:1000MSMemory Limit:65536KTotal Submissions:9899Accepted:3717DescriptionIt's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment AT 阅读全文

posted @ 2013-06-27 17:59 kuangbin 阅读(3297) 评论(3) 推荐(0)

ZOJ 4114 Detect the Virus(AC自动机)
摘要:Detect the VirusTime Limit:2 Seconds Memory Limit:65536 KBOne day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor computer slow and the virus was activated by a misoperation of opening an attachment of an email 阅读全文

posted @ 2013-06-27 15:23 kuangbin 阅读(973) 评论(0) 推荐(0)

HDU 2896 病毒侵袭(AC自动机)
摘要:病毒侵袭Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7400Accepted Submission(s): 1945Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气, 阅读全文

posted @ 2013-06-26 19:44 kuangbin 阅读(4271) 评论(1) 推荐(1)

POJ 2185 Milking Grid(KMP)
摘要:Milking GridTime Limit:3000MSMemory Limit:65536KTotal Submissions:4738Accepted:1978DescriptionEvery morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1 #include #include #include #include using namespace std;char str[10010][100];int R,C;bool same1(int i,int 阅读全文

posted @ 2013-06-25 09:53 kuangbin 阅读(1100) 评论(0) 推荐(0)

UVA 10054 The Necklace(欧拉回路,打印路径)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=995Problem D: The NecklaceMy little sister had a beautiful necklace made of colorful beads. Two successive beads in the necklace shared a common color at their meeting point. The figure be 阅读全文

posted @ 2013-06-22 13:47 kuangbin 阅读(816) 评论(0) 推荐(0)

HDU 4562 守护雅典娜(dp)
摘要:守护雅典娜Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 324Accepted Submission(s): 91Problem Description许多塔防游戏都是以经典的“守护雅典娜”为原型的。玩家需要建立各种防御工具来阻止怪物接近我们的女神——雅典娜。这里,我们可以建造的防御工具只有标准圆形状的防御墙,建立在雅典娜与怪物出生点之间的防御墙数目越多,胜利的希望就越大。这里,将问题简化到一个二维坐标系里,并且假设雅典娜的坐标为原点(0, 阅读全文

posted @ 2013-06-22 10:18 kuangbin 阅读(880) 评论(0) 推荐(0)

POJ 1679 The Unique MST(次小生成树)
摘要:The Unique MSTTime Limit:1000MSMemory Limit:10000KTotal Submissions:16984Accepted:5892DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, s 阅读全文

posted @ 2013-06-20 22:15 kuangbin 阅读(5576) 评论(0) 推荐(0)

POJ 3026 Borg Maze(bfs+最小生成树)
摘要:Borg MazeTime Limit:1000MSMemory Limit:65536KTotal Submissions:6634Accepted:2240DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Each Borg 阅读全文

posted @ 2013-06-20 20:09 kuangbin 阅读(3152) 评论(1) 推荐(1)

POJ 1062 昂贵的聘礼 (最短路)
摘要:昂贵的聘礼Time Limit:1000MSMemory Limit:10000KTotal Submissions:30963Accepted:8737Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,他可 阅读全文

posted @ 2013-06-18 19:15 kuangbin 阅读(1301) 评论(0) 推荐(0)

POJ 2502 Subway
摘要:SubwayTime Limit:1000MSMemory Limit:65536KTotal Submissions:4928Accepted:1602DescriptionYou have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don't want to be la 阅读全文

posted @ 2013-06-18 16:33 kuangbin 阅读(2192) 评论(0) 推荐(0)

POJ 3159 Candies(差分约束,最短路)
摘要:CandiesTime Limit:1500MSMemory Limit:131072KTotal Submissions:20067Accepted:5293DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the kids lov 阅读全文

posted @ 2013-06-17 22:35 kuangbin 阅读(1842) 评论(0) 推荐(1)

POJ 1511 Invitation Cards(单源最短路,优先队列优化的Dijkstra)
摘要:Invitation CardsTime Limit:8000MSMemory Limit:262144KTotal Submissions:16178Accepted:5262DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They 阅读全文

posted @ 2013-06-17 19:54 kuangbin 阅读(2467) 评论(0) 推荐(0)

POJ 3660 Cow Contest(传递闭包floyed算法)
摘要:Cow ContestTime Limit:1000MSMemory Limit:65536KTotal Submissions:5989Accepted:3234DescriptionN(1 ≤N≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is unique among 阅读全文

posted @ 2013-06-17 18:10 kuangbin 阅读(2378) 评论(0) 推荐(0)

POJ 1502 MPI Maelstrom(最短路)
摘要:MPI MaelstromTime Limit:1000MSMemory Limit:10000KTotal Submissions:4017Accepted:2412DescriptionBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research advis 阅读全文

posted @ 2013-06-17 15:30 kuangbin 阅读(966) 评论(1) 推荐(0)

POJ 3259 Wormholes(最短路,判断有没有负环回路)
摘要:WormholesTime Limit:2000MSMemory Limit:65536KTotal Submissions:24249Accepted:8652DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE 阅读全文

posted @ 2013-06-17 15:26 kuangbin 阅读(896) 评论(0) 推荐(0)

POJ 3268 Silver Cow Party (最短路)
摘要:Silver Cow PartyTime Limit:2000MSMemory Limit:65536KTotal Submissions:10147Accepted:4497DescriptionOne cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirectional (one-way roads connects p 阅读全文

posted @ 2013-06-16 00:12 kuangbin 阅读(1105) 评论(0) 推荐(0)

POJ 1797 Heavy Transportation (Dijkstra算法,求路径的最小值中的最大值)
摘要:Heavy TransportationTime Limit:3000MSMemory Limit:30000KTotal Submissions:17314Accepted:4546DescriptionBackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his cu 阅读全文

posted @ 2013-06-15 18:33 kuangbin 阅读(1014) 评论(0) 推荐(0)

POJ 2253 Frogger (求每条路径中最大值的最小值,Dijkstra变形)
摘要:FroggerTime Limit:1000MSMemory Limit:65536KTotal Submissions:20314Accepted:6601DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen 阅读全文

posted @ 2013-06-15 18:30 kuangbin 阅读(745) 评论(0) 推荐(0)

POJ 2253 Frogger (最短路,floyed)
摘要:FroggerTime Limit:1000MSMemory Limit:65536KTotal Submissions:20310Accepted:6597DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen 阅读全文

posted @ 2013-06-14 15:40 kuangbin 阅读(2795) 评论(0) 推荐(0)

导航

JAVASCRIPT: