亟隐

朝不闻道,夕亦死可矣

08/7
00:21
数据结构 算法区

HDU 5361 In Touch

地址:戳这里

Problem Description

There are n soda living in a straight line. soda are numbered by 1,2,,n from left to right. The distance between two adjacent soda is 1 meter. Every soda has a teleporter. The teleporter of i-th soda can teleport to the soda whose distance between i-th soda is no less than li and no larger than ri. The cost to use i-th soda’s teleporter is ci.

The 1-st soda is their leader and he wants to know the minimum cost needed to reach i-th soda (1in).

Read More →

08/5
01:00
图论 算法区

HDU 5348 MZL's endless loop

地址:戳这里

Problem Description
As we all kown, MZL hates the endless loop deeply, and he commands you to solve this problem to end the loop.
You are given an undirected graph with n vertexs and m edges. Please direct all the edges so that for every vertex in the graph the inequation |out degree  in degree|1 is satisified.
The graph you are given maybe contains self loops or multiple edges.

Read More →

08/2
22:32
图论 算法区

HDU 4338 Simple Path

地址:戳这里

Problem Description
Everybody knows that totalfrank has absolutely no sense of direction. Getting lost in the university or nearly supermarket is very common for him. We always worry about whether he can find his way back into our sweet base whenever he goes out alone for his class. In general, if totalfrank get lost again, we need to check his starting point and destination just in order to find out where he could be (you know this task is very common for us). Read More →
08/2
22:26
算法区

HDU 4328 Cut the cake

地址:戳这里

Problem Description

Mark bought a huge cake, because his friend ray_sun’s birthday is coming. Mark is worried about how to divide the cake since it’s so huge and ray_sun is so strange. Ray_sun is a nut, you can never imagine how strange he was, is, and going to be. He does not eat rice, moves like a cat, sleeps during work and plays games when the rest of the world are sleeping……It is not a surprise when he has some special requirements for the cake. A considering guy as Mark is, he will never let ray_sun down. However, he does have trouble fulfilling ray_sun’s wish this time; could you please give him a hand by solving the following problem for him? Read More →

08/1
00:51
算法区

HDU 4315 Climbing the Hill

地址:戳这里

Problem Description

Alice and Bob are playing a game called “Climbing the Hill”. The game board consists of cells arranged vertically, as the figure below, while the top cell indicates the top of hill. There are several persons at different cells, and there is one special people, that is, the king. Two persons can’t occupy the same cell, except the hilltop. Read More →

08/1
00:42
DP 算法区

HDU 4314 Save the dwarfs

地址:戳这里

Problem Description

Several dwarfs are trapped in a deep well. They are not tall enough to climb out of the well, so they want to make a human-pyramid, that is, one dwarf stands on another’s shoulder, until the dwarf on the top can reach the top of the well when he raise his arms up. More precisely speaking, we know the i-th dwarf’s height from feet to shoulder is Ai, and his arm length Bi. And we know the height of the well is H. If we can build a dwarf-tower consists of dwarf 1, dwarf 2, …, dwarf k from bottom to top, such that A1 + A2 + … + Ak-1 + Ak + Bk >= H, then dwarf k can escape from the well. Obviously, the escaped dwarf can’t be used to build tower again. Read More →

07/29
15:54
数据结构 算法区

BZOJ 3626 [LNOI2014]LCA

地址:戳这里

Description

给出一个n个节点的有根树(编号为0到n-1,根节点为0)。一个点的深度定义为这个节点到根的距离+1。
设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公共祖先。
有q次询问,每次询问给出l r z,求sigma_{l<=i<=r}dep[LCA(i,z)]。
(即,求在[l,r]区间内的每个节点i与z的最近公共祖先的深度之和)

Read More →

07/27
19:29
数据结构 算法区

HDU 4288 Coder

地址:戳这里

Problem Description

  In mathematics and computer science, an algorithm describes a set of procedures or instructions that define a procedure. The term has become increasing popular since the advent of cheap and reliable computers. Many companies now employ a single coder to write an algorithm that will replace many other employees. An added benefit to the employer is that the coder will also become redundant once their work is done. 1 Read More →