Dining Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 19461 Accepted: 8670 DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, an...
阅读(3) 评论(0)

UVA 796 Critical Links(Tarjan求无向图中的桥)

桥:割边,即去掉之后原本连通的分支不再连通 求法:和割点差不多 只要 dfn[i]小于low[j],则ij就是割边 注意这题的输出格式,格式错误导致的wa了好几次,gg…..输出格式只要复制就可以了啊……. 还要按第一个输出点升序排序。。。。In a computer network a link L, which interconnects two servers, is consider...
阅读(17) 评论(0)

UVA 315 Network(Tarjan求无向图割点)

割点:删除该点和相关边,原来的连通图能变得不连通的点 求法: 当节点i是根(搜索起点)时,只要它的孩子多于两个,那么它就是割点,不用考虑形成环的情况,因为在遍历另一个形成环的点的孩子时,就已经从第一个形成环的孩子遍历到了它当节点i不是根的时候,它的孩子是j,当dfn[i]>=low[j]时,就是割点,因为当dfn[i]#include #include #...
阅读(23) 评论(0)

HDU 1269 迷宫城堡(Tarjan or Kosaraju模板)

迷宫城堡Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17917 Accepted Submission(s): 7852Problem Description 为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间...
阅读(28) 评论(0)

POJ 1236(强连通分量+Kosaraju)

Limit: 1000MS Memory Limit: 10000K Total Submissions: 19625 Accepted: 7732 DescriptionA number of schools are connected to a computer network. Agreements have been developed among those s...
阅读(83) 评论(0)

HDU 5536(01字典树)

John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces n...
阅读(51) 评论(0)

HDU 3336 Count the strings(KMP+DP)

It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example: s: “abab...
阅读(39) 评论(0)

HDU 1358 Peroid(KMP和循环节)

For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 <...
阅读(49) 评论(0)

HDU 3746 Cyclic Nacklace (KMP和循环节)

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to...
阅读(52) 评论(0)

HDU 2087 剪花布条(KMP查找不交叉区间的模式串个数)

一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 Output...
阅读(42) 评论(0)

HDU 1686 Oulipo (KMP查找可交叉区间模式串)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’af...
阅读(42) 评论(0)

HDU 1711 Number Sequence (KMP模板)

Given two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], …… , a[K...
阅读(33) 评论(0)


There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1m−1 and the frogs are numbered from 11 to nn. The ii-th frog can jump over exactly aia...
阅读(47) 评论(0)

Watto and Mechanism(字符串hash算法)

Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the...
阅读(54) 评论(0)

LCA 模板

A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an integer from {1, 2,…,16}. Node 8 is the root of...
阅读(46) 评论(0)


百度科技园内有nn个零食机,零食机之间通过n−1n−1条路相互连通。每个零食机都有一个值vv,表示为小度熊提供零食的价值。 由于零食被频繁的消耗和补充,零食机的价值vv会时常发生变化。小度熊只能从编号为0的零食机出发,并且每个零食机至多经过一次。另外,小度熊会对某个零食机的零食有所偏爱,要求路线上必须有那个零食机。 为小度熊规划一个路线,使得路线上的价值总和最大。 Input 输入数据第一行是...
阅读(57) 评论(0)

HDU 1698 Just A Hook(线段树修改区间到某值)

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.  No...
阅读(52) 评论(0)

Puzzles (树形dp+组合数学)

Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney’s not sure why it is...
阅读(52) 评论(0)

Contestant Division(树形dp)

In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own universities. However there’s one problem. Due to the...
阅读(54) 评论(0)

God Father (树形dp 树的重心)

Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders.Unfortunately, the structure of...
阅读(49) 评论(0)
83条 共5页1 2 3 4 5 ... 下一页 尾页
    • 访问:5123次
    • 积分:837
    • 等级:
    • 排名:千里之外
    • 原创:77篇
    • 转载:0篇
    • 译文:1篇
    • 评论:0条