Description:State Z is a underwater kingdom of the Atlantic Ocean. This country is amazing. There are $n$ cities in the country and $n-1$ undirected underwater roads which connect all cities.In ord...

Description:Gromah and LZR have entered the fifth level. Unlike the first four levels, they should do some moves in this level.There are $n$ vertices and $m$ bidirectional roads in this level, each...

Description:Years later, Jerry fell in love with a girl, and he often walks for a long time to pay visits to her. But, because he spends too much time with his girlfriend, Tom feels neglected and w...

Description:The Lich is a powerful hero that he can kill a wisp with his skill Frost Nova. The Burning Legion wants to conquer the forest so they sent some liches to kill all the wisps. A lich can ...

Description:You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y = 10. The initial and f...

Description:One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are $N$ spots in the jail a...

Description:There are $N$ cities in the country, and $M$ directional roads from $u$ to $v(1\le u, v\le n)$. Every road has a distance $c_i$. Haze is a Magical Girl that lives in City $1$, she can c...

Description:There are N vertices connected by N−1 edges, each edge has its own length. The set { 1,2,3,…,N } contains a total of N! unique permutations, let’s say the i-th permutation is Pi and Pi,...

Description:Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M s...

Description:On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little ...

Description:Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we are kids. What a happy...

Description:As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the same...

Description:Consider a network G=(V,E) with source s and sink t. An s-t cut is a partition of nodes set V into two parts such that s and t belong to different parts. The cut set is the subset of E ...

Description:Do not sincere non-interference。Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls are in city B. Every time st...

Description:If you solved problem like this, forget it.Because you need to use a completely different algorithm to solve the following one.Kakuro puzzle is played on a grid of "black" and "white" c...

Description:The regime of a small but wealthy dictatorship has been abruptly overthrown by an unexpected rebellion. Because of the enormous disturbances this is causing in world economy, an imperia...