Search Techniques

摘要: Sample Problem: n Queens [Traditional]Place n queens on an n x nchess board so that no queen is attacked by another queen.Depth First Search (DFS)The most obvious solution to code is to add queens recursively to the board one by one, trying all possible queen placements. It is easy to exploit the fa 阅读全文
posted @ 2012-10-17 17:52 makeecat 阅读(173) 评论(0) 推荐(0) 编辑

Greedy Algorithm

摘要: Greedy AlgorithmSample Problem: Barn Repair [1999 USACO Spring Open]There is a long list of stalls, some of which need to be covered with boards. You can use up to N (1 <= N <= 50) boards, each of which may cover any number of consecutive stalls. Cover all the necessary stalls, while covering 阅读全文
posted @ 2012-10-17 17:52 makeecat 阅读(179) 评论(0) 推荐(0) 编辑

Complete Search

摘要: Complete Search The IdeaSolving a problem using complete search is based on the ``Keep It Simple, Stupid'' principle. The goal of solving contest problems is to write programs that work in the time allowed, whether or not there is a faster algorithm.Complete search exploits the brute force, 阅读全文
posted @ 2012-10-17 17:52 makeecat 阅读(160) 评论(0) 推荐(0) 编辑

Crafting Winning Solutions

摘要: Complete Search The IdeaSolving a problem using complete search is based on the ``Keep It Simple, Stupid'' principle. The goal of solving contest problems is to write programs that work in the time allowed, whether or not there is a faster algorithm.Complete search exploits the brute force, 阅读全文
posted @ 2012-10-17 17:51 makeecat 阅读(166) 评论(0) 推荐(0) 编辑

Ad Hoc Problems

摘要: Ad Hoc Problems `Ad hoc' problems are those whose algorithms do not fall into standard categories with well-studied solutions. Each ad hoc problem is different; no specific or general techniques exist to solve them.Of course, this makes the problems the `fun' ones, since each one presents a 阅读全文
posted @ 2012-10-17 17:51 makeecat 阅读(216) 评论(0) 推荐(0) 编辑

Programming Contest Problem Types

摘要: Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and made an amazing discovery: there are only 16 types of programming contest problems! Furthermore, the top several comprise almost 80% of the problems seen at the IOI. Here they are:Dynamic ProgrammingGreed 阅读全文
posted @ 2012-10-17 17:49 makeecat 阅读(173) 评论(0) 推荐(0) 编辑

1.4.1 Packing Rectangles

摘要: Packing RectanglesIOI 95The six basic layouts of four rectanglesFour rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle, we mean the one with the smallest area.All four rectangles should have their sides pa 阅读全文
posted @ 2012-10-03 14:58 makeecat 阅读(325) 评论(0) 推荐(0) 编辑

1.3.4 Prime Cryptarithm

摘要: Prime CryptarithmThe following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM. * * * x * * ... 阅读全文
posted @ 2012-10-03 14:52 makeecat 阅读(203) 评论(0) 推荐(0) 编辑

1.3.3 Calf Flac

摘要: Calf FlacIt is said that if you give an infinite number of cows an infinite number of heavy-duty laptops (with very large keys), that they will ultimately produce all the world's great palindromes. Your job will be to detect these bovine beauties.Ignore punctuation, whitespace, numbers, and case 阅读全文
posted @ 2012-10-03 14:51 makeecat 阅读(219) 评论(0) 推荐(0) 编辑

1.3.2 Barn Repair

摘要: Barn RepairIt was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely full.The cows spend the night in stalls that are arranged adjacent to each other in a long line. Some s 阅读全文
posted @ 2012-10-03 14:50 makeecat 阅读(140) 评论(0) 推荐(0) 编辑