自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(344)
  • 收藏
  • 关注

原创 Eliminate the Conflict(2 - sat)

icts are everywhere in the world, from the young to the elderly, from families to countries. Conflicts cause quarrels, fights or even wars. How wonderful the world will be if all conflicts can be eliminated.Edward contributes his lifetime to invent a 'Conf

2014-12-04 16:16:25 120

原创 Juice Extractor(树状数组 + dp)

n and gain the bonus from cutting more than two fruits with a single slice. Once a fruit is cut, it breaks into small pieces and cannot be cut any more.After months of training, he becomes pro of this game. Actually, he can cut all the fruits on the scre

2014-12-01 21:41:19 278

原创 Hacking Cypher(数学)

ing into a new secure messenger. He's almost won.Having carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtained if he properly cuts the public key of the application into two parts. The public key

2014-11-29 17:26:16 130

原创 Diverse Permutation(构造)

s p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, 

2014-11-29 14:06:55 163

原创 Flowers(DP)

Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flowers. Therefore a dinner can be represented as a sequence of several flowers, some of them white and some of them red.But, for a dinner

2014-11-29 11:50:41 97

原创 Beam Cannon(线段树 + 扫描线)

alaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by other planets. Now, a large wave of enemy spaceships is approaching. There is a very large Beam Cannon on the Planet X, and it is very powerful

2014-11-04 16:10:30 143

原创 Game with Pearls(二分图)

are playing a game with tubes and pearls. The rule of the game is:1) Tom and Jerry come up together with a number K. 2) Tom provides N tubes. Within each tube, there are several pearls. The number of pearls in each tube is at least 1 and at most N. 3) Jer

2014-11-03 18:04:01 50

原创 Battle ships(二分图)

ow you are an excellent navy commander, who is responsible of a tough mission currently. Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are negative for both sides. The floating ice and iceberg blo

2014-11-02 19:33:09 123

原创 Qin Shi Huang's National Road System(最小生成树 + LCA)

scriptionDuring the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China ---- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the kingdom Qin. Through 9 years of wars, he finally conquere

2014-11-02 11:33:20 110

原创 Coprime(容斥定理 + 筛选)

standing in a line. Each of them has a unique id number.Now the Ragnarok is coming. We should choose 3 people to defend the evil. As a group, the 3 people should be able to communicate. They are able to communicate if and only if their id numbers are pairw

2014-10-28 20:36:45 64

原创 Known Notation(分析模拟)

nown as postfix notation since every operator in an expression follows all of its operands. Bob is a student in Marjar University. He is learning RPN recent days.To clarify the syntax of RPN for those who haven't learnt it before, we will offer some exam

2014-10-28 17:46:14 80

原创 Domination(概率DP)

is friends. What's more, he bought a large decorative chessboard with N rows and M columns.Every day after work, Edward will place a chess piece on a random empty cell. A few days later, he found the chessboard was dominated by the chess pieces. That mea

2014-10-21 20:18:40 106

原创 Design the city(LCA + RMQ)

ams everywhere. Now, Cerror finds out that the main reason of them is the poor design of the roads distribution, and he want to change this situation.In order to achieve this project, he divide the city up to N regions which can be viewed as separate poi

2014-10-09 13:15:48 65

原创 Connections between cities(LCA + 并查集)

After World War X, a lot of cities have been seriously damaged, and we need to rebuild those cities. However, some materials needed can only be produced in certain places. So we need to transport these materials from city to city. For most of roads had be

2014-10-02 14:21:27 113

原创 Distance Queries(LCA 在线算法 RMQ)

run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to find a path of a more reasonable length. The input to this problem consists of the same input as in "Navigation Nightmare",followed by a

2014-10-02 13:31:16 77

原创 How far away ?(LCA 在线算法RMQ)

n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it hard to answer. But luckily int this village the answer is alwa

2014-10-02 13:01:21 70

原创 Nearest Common Ancestors(LCA 离线算法)

omputer 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 the tree. Node x is an ancestor of node y if node x is in the path between the root and node y. For e

2014-09-30 17:41:43 63

原创 24 Game(数学构造)

recently he has found it too easy. So he invented a new game.Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and b, erase them from the sequence, and append to the sequence either

2014-09-23 17:15:03 93

原创 Explosion(bitset 优化的传递闭包 + 概率)

t enjoys playing games very much. Now, he is playing such a game. There are N rooms, each with one door. There are some keys(could be none) in each room corresponding to some doors among these N doors. Every key can open only one door. Matt has some bombs,

2014-09-23 15:59:24 85

原创 Saving Tang Monk(BFS)

o 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 King Sun Wukong, pig Zhu Bajie and Sha Wujing, escorted Tang Monk to India to get sacre

2014-09-23 15:09:20 280

原创 Information Graph(并查集)

(let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events took place:either employee y became the boss of employee x (at that, employee x 

2014-09-18 18:06:36 80

原创 233 Matrix(矩阵快速幂)

we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the question: Suppose we have a matrix called 233 matrix. In the first line, it would be 233, 2333, 23333... (it means a0,1 = 233,a0

2014-09-16 19:55:40 93

原创 Number Sequence(二进制)

There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● ai ∈ [0,n] ● ai ≠ aj( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows(“⊕” denotes exclusive or):t = (a0 ⊕

2014-09-15 19:17:28 59

原创 Dice(BFS)

ices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A. Similarly, consider b1.b2,b3,b4,b5,b6 to be nu

2014-09-15 19:05:59 72

原创 Walk(概率DP)

think I could be anything, but now I know that I couldn't do anything. So I started traveling.The nation looks like a connected bidirectional graph, and I am randomly walking on it. It means when I am at node i, I will travel to an adjacent node with the

2014-09-15 18:59:16 56

原创 Untrusted Patrol(DFS)

in the factory.To ensure the safety of drinks, Edward hired a security man to patrol the warehouse. The warehouse has N piles of drinks and M passageways connected them (warehouse is not big enough). When the evening comes, the security man will start to

2014-09-09 16:07:50 47

原创 LITTLE SHOP OF FLOWERS(DP)

n a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glued onto the shelf and are numbered consecutively 1 through V, where V is the number of vases, from left to r

2014-09-06 15:34:15 50

原创 月老的难题(二分图最大匹配)

2014-09-06 11:02:26 57

原创 Battle City(BFS)

nd some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers, steel walls and brick walls only. Your task is to get a bonus as soon as possible supp

2014-09-06 10:35:09 74

原创 Jungle Roads(最小生成树 + 并查集)

blem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. The Council of Elders must choose to stop maintaining some roa

2014-09-06 09:57:48 86

原创 Stockbroker Grapevine(Floyd)

have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible way. Unfortunately for you

2014-09-05 23:26:06 65

原创 Cow Contest(Floyd 传递闭包)

articipating 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 the competitors.The contest is conducted in several head-to-head rounds, each between two cows. If

2014-09-05 15:54:07 52

原创 网络的可靠性(杂)

助商。它将提供先进的网络协作技术,展示其”智能+互联“的生活概念,同时为参观者提供高品质的个人体验和互动,以”信息通信,尽情城市梦想”为主题贯穿。借助奇幻的剧场大屏幕和特效,展现信息通信技术的应用前景,通过生动形象的故事,向观众展示沟通无限制的未来社会前景。为此,A公司为世博园的N个区域建立了视频通信系统,其中每个区域建立一个基站,编号依次为1,2,3...,N。通过基站之间的通信线路为各区域的参观者提供视频服务。已知在各基站之间已铺设了一些光纤通讯线路,这些线路覆盖了所有的区域,即任意两个区域都可

2014-09-05 11:54:08 115

原创 星际之门(cayley 定理)

行旅行的,近来,X博士发明了星际之门,它利用虫洞技术,一条虫洞可以连通任意的两个星系,使人们不必再待待便可立刻到达目的地。帝国皇帝认为这种发明很给力,决定用星际之门把自己统治的各个星系连结在一起。可以证明,修建N-1条虫洞就可以把这N个星系连结起来。现在,问题来了,皇帝想知道有多少种修建方案可以把这N个星系用N-1条虫洞连结起来?  输入第一行输入一个整数T,表示测试数据的组数(T<=100)每组测试数据只有一行,该行只有一个整数N,表示有N个星系。(2&amp

2014-09-05 10:35:26 92

原创 校园网络(强连通分量)

如果某系有新软件可用时,该系将允许一些其它的系复制并使用该软件。但该允许关系是单向的,即:A系允许B系使用A的软件时,B未必一定允许A使用B的软件。现在,请你写一个程序,根据各个系之间达成的协议情况,计算出最少需要添加多少个两系之间的这种允许关系,才能使任何一个系有软件使用的时候,其它所有系也都有软件可用。 输入第一行输入一个整数T,表示测试数据的组数(T<10)每组测试数据的第一行是一个整数M,表示共有M个系(2<=M<=100)。随后的M行,

2014-09-05 09:56:57 47

原创 修路方案(次小生成树)

2014-09-04 14:38:58 73

原创 The Unique MST(次小生成树)

ning 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, say T = (V', E'), with the following properties: 1. V' = V. 2. T is connected and acyclic. Definition 2 (Minimum

2014-09-04 14:36:40 44

原创 城市平乱(最短路)

2014-09-04 11:54:38 42

原创 一笔画问题(欧拉回路 + 并查集)

2014-09-03 17:28:34 203

原创 布线问题(最小生成树 + 并查集)

2014-09-03 17:07:24 79

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除