#《算法竞赛入门经典——训练指南》第一章相关内容
希望各位大牛能指导!
红色为已经做了的。。。黄色背景是还有不懂地方,希望在年前能刷完第一章啊。。。。
更新版。google上貌似又加了extra 然后分类更仔细了。所以我重新弄了下
勘误
[第二次印刷改正]P34. 最后一行,“k是叶子和服务器的距离下限”应改为“k是叶子和服务器的距 离上限”
P49. 最下方的括号中,“本题中所有的Ai均为整数”应该为“本题中所有的Ai均为正数”
[第二次印刷改正]P63 第一行,“当Ai=Aj时”改成“当Ai=Bj时”。
p63. 问题11的最后一行中27*1+(243+2)*2... 应该是 27*1+(243+3)*2+(729+81+9+1)*3=2979
p67. 例题28的题目描述中,应改为“每次玩家只能从左端或者右端取任意数量个数”
[第二次印刷改正]p80 Uva 11627 翻译错误 输出不是数量 应是速度能通过的速度最大的滑雪板的速度。
P82. 习题LA4850题目描述中的举例,最后一个二元组应该是(3,8)而不是(6,8)。
问题求解策略
例题 (Examples)
例题 1 | The Dragon of Loowater | 排序后用贪心法 | |
例题 2 | Commando War | 用贪心法求最优排列;用“相邻交换法”证明正确性 | |
例题 3 | Spreading The Wealth | 用代数法进行数学推导;中位数 | |
例题 4 | Graveyard | 推理;参考系 | |
例题 5 | Piotr's Ants | 等效变换;排序 | |
例题 6 | Image is Everything | 三维坐标系;迭代更新 | |
例题 7 | Even Party | 部分枚举;递推 | |
例题 8 | Colored Cubes | 部分枚举;贪心 | |
例题 9 | Chinese Mahjong | 回溯法;以中国麻将为背景 | |
例题 10 | Help is needed for Dexter | 问题转化;递归 | |
例题 11 | A Different Task | 汉诺塔问题;递归 | |
例题 12 | Assemble | 二分法;贪心 | |
例题 13 | Pie | 二分法 | |
例题 14 | Fill the Square | 求字典序最小的解;贪心 | |
例题 15 | Network | 树上的最优化问题;贪心 | |
例题 16 | Beijing Guards | 二分法;贪心 |
入门习题 (Exercises:Beginner)
Hello World! | ||
Building Designing | ||
Ancient Cipher | ||
DNA Consensus String | ||
Big Chocolate | 不需要动态规划 | |
All in All |
| |
Watering Grass | 经典模型;贪心 | |
Songs | 相邻交换法 | |
Equipment | 需认真分析题目 | |
Leet | 以“火星文”为背景的题目 | |
(extra)UVa10012 | How Big Is It? | 用最小的矩形包住n<=8个圆。回溯法 |
(extra)UVa10020 | Minimal coverage | 数轴上有一些线段,选一些总长度尽量少的线段,覆盖区间[0,M] |
(extra)UVa10026 | Shoemaker's Problem | 经典问题。贪心法 |
(extra)UVa10317 | Equating Equations |
|
(extra)UVa10318 | Security Panel |
|
(extra)UVa10670 | Work Reduction |
|
中级习题 (Exercises:Intermediate)
Children's Game | 贪心。容易想错!建议编程并提交 | ||
Processor | 二分法 |
| |
Slalom | 二分法 |
| |
Fabled Rooks | 经典问题的变形 |
| |
The Trip, 2007 |
|
| |
Tian Ji - The Horse Racing | 有多种方法 |
| |
The Bus Driver Problem | 有多种方法 |
| |
Wonder Team |
|
| |
Keep the Customer Satisfied | 经典问题的变形 |
| |
Ugly Windows | 注意细节 |
| |
Priest John's Busiest Day | 认真分析题目 |
| |
Cubist Artwork | 有趣的题目;逻辑推理 |
| |
Archery | 枚举。注意特殊情况和精度 |
| |
Ruler | 搜索 |
| |
Mobile Computing | 枚举二叉树 |
| |
Power Calculation | 经典的搜索题目;注意优化 |
| |
(extra)UVa10037 | Bridge | 有趣的过河问题。分情况讨论;贪心法 |
|
(extra)UVa10602 | Editor Nottoobad |
|
|
(extra)UVa10716 | Evil Straw Warts Live |
|
|
(extra)UVa11127 | Triple-Free Binary Strings |
|
|
提高习题 (Exercises:Advanced)
Airport | ||
Installations | ||
Supermarket | 经典问题 | |
Compress the String | 搜索。需要优化 | |
Yummy Triangular Pizza | ||
Anagram and Multiplication | 枚举(需要猜想) | |
Square Puzzle | 回溯法。注意细节 | |
Bingo | 注意枚举方式 | |
Houses Divided | 搜索;需要优化 | |
Hobby on Rails | 比较繁琐的搜索题目 | |
(extra)UVa10383 | Queen vs Rook |
|
(extra)UVa10411 | Another Game of Tetris |
|
(extra)UVa10414 | Denki Blocks |
|
(extra)UVa10492 | Optimal Mastermind Strategy |
|
(extra)UVa10571 | Products |
|
(extra)UVa10605 | Mines For Diamonds |
|
(extra)UVa10628 | Quadrills |
|
(extra)UVa10632 | Pyramid |
|
(extra)UVa10833 | Lunar Forest |
|
(extra)UVa11694 | Gokigen Naname |
|
(extra)UVa11794 | Dazzling Puzzle |
|
(extra)UVa11846 | Finding Seats Again |
|
高效算法设计
例题 (Examples)
例题 17 | Age Sort | 排序后用贪心法 | |
例题 18 | Open Credit System | 扫描、维护最大值 | |
例题 19 | Calculator Conundrum | Floyd判圈算法 | |
例题 20 | Meteor | 线性扫描;事件点处理 | |
例题 21 | Subsequence | 线性扫描;前缀和;单调性 | |
例题 22 | City Game | 递推;扫描法 | |
例题 23 | Distant Galaxy | 枚举;线性扫描 | |
例题 24 | Garbage heap | 前缀和、降维、递推 | |
例题 25 | Jurassic Remains | 中途相遇法 |
入门习题 (Exercises: Beginner)
Sumsets | 中途相遇法 | |
Foreign Exchange | 快速检索 | |
Compound Words | 字符串检索;哈希表 | |
Wine trading in Gergovia | 扫描法 | |
(extra)UVa10324 | Zeroes and Ones |
|
中级习题 (Exercises:Intermediate)
Hypertransmission | 扫描;维护信息 | ||
Maximum sum on a torus | 前缀和;降维 | ||
Average | 数形结合或者单调队列 | ||
Selling Land |
| ||
Fire-Control System | 扫描法 | ||
Cricket Field | 在W*H网格里找一个最大空正方形 | ||
Genome Evolution |
| ||
DNA Regions | 利用数学变形或者数形结合 | ||
Cav |
| ||
Balancing the Scale | 用空间换时间 | ||
Shuffle | 有多种方法 |
| |
Soju |
|
| |
You are around me ... |
|
| |
(extra)UVa10132 | File Fragmentation |
|
|
(extra)UVa10691 | Subway |
|
|
(extra)UVa11589 | Save the President |
|
|
提高习题 (Exercises: Advanced)
Restaurant | |
Knowledge for the masses |
动态规划
例题
例题 26 | And Then There Was One | 递归、问题转化 | |
例题 27 | Prince and Princess | LCS;可转化为LIS | |
例题 28 | Sum | 避免重复计算 | |
例题 29 | Hacker's Crackdown | 集合动态规划;子集枚举 | |
例题 30 | Placing Lampposts | 树上的动态规划(此题真心好题) | |
例题 31 | Robotruck | 动态规划;滑动窗口优化;单调队列 | |
例题 32 | Sharing Chocolate | 集合动态规划、状态精简 |
入门习题 (Exercises: Beginner)
Partitioning by Palindromes | 入门题目 | |
Salesman | 入门题目 | |
Wavio Sequence | 可以转化为经典问题,时间O(nlogn) | |
Fewest Flops | 序列划分模型;状态设计 | |
Palindromic Subsequence | 可以转化为LCS | |
Cellular Network | 需要一点概率知识和推理 | |
Mega Man's Missions | 基础的集合动态规划 | |
Jump | Joseph问题的变形 | |
Martian Mining | 模型简单,但需要减少重复计算 | |
Paths through the Hourglass | 类似01 背包问题 | |
Headmaster's Headache | 集合动态规划 | |
Strategic Game | 树上动态规划(基础题) | |
String Compression | 字符串动态规划 | |
Dance Dance Revolution | 以跳舞机为背景的题目 | |
Twenty Questions | 有趣的问题;比较基础的动态规划 | |
(extra)UVa10163 | Storage Keepers |
|
(extra)UVa10453 | Make Palindrome |
|
中级习题 (Exercises:Intermediate)
Free Goodies | 也可以贪心,时间效率更高 | |
Parade | 模型不难想,但需要优化 | |
Cave | 树的动态规划 | |
Help Bubu |
| |
Masud Rana | 注意状态表示 | |
Evacuation Plan |
| |
Mountain Road |
| |
Moving to Nuremberg |
| |
Hanoi Towers |
| |
Tour | 经典问题 | |
Pesky Heroes | 树的动态规划(题目不太好理解) | |
Pitcher Rotation | 需要一点优化(精简状态) | |
Roommate |
| |
Period |
| |
Log Jumping | 可以转化为经典问题 | |
Frontier | 涉及到几何(见第四章)的动态规划 | |
Minimax Triangulation |
| |
Interconnect | 注意状态表示 | |
Alice and Bob's Trip | 树上的动态规划 | |
Bigger is Better | 有多种方法。可以不用高精度 | |
(extra)UVa10003 | Cutting Sticks | 经典的动态规划题目。可以用四边形不等式优化 |
(extra)UVa10239 | The Book-shelver's Problem |
|
(extra)UVa10271 | Chopsticks |
|
(extra)UVa10304 | Optimal Binary Search Tree |
|
(extra)UVa10599 | Robots(II) |
|
(extra)UVa10604 | Chemical Reaction |
|
(extra)UVa10618 | Tango Tango Insurrection |
|
(extra)UVa10641 | Barisal Stadium |
|
(extra)UVa10671 | Grid Speed |
|
(extra)UVa10688 | The Poor Giant |
|
(extra)UVa11263 | Nested Rectangles |
|
(extra)UVa11400 | Lighting System Design |
|
(extra)UVa11578 | Situp Benches |
|
(extra)UVa11691 | Allergy Test |
|
(extra)UVa11766 | Racing Car Computer |
|
(extra)UVa12002 | Happy Birthday |
|
提高习题(Exercises:Advanced)
String Painter | 序列的动态规划,有一定难度 | |
Exclusive Access 2 |
| |
Fund Management | 注意状态表示 | |
Garlands |
| |
A Scheduling Problem | 树的动态规划 | |
The Bookcase | 不太容易想到,且需要优化 | |
Peach Blossom Spring | 一类经典题目(最早出现在NWERC2006,但本题数据更强) | |
The Best Name for Your Baby | 有难度的动态规划;注意计算顺序 | |
The Ultimate Password | 有难度的动态规划;注意计算顺序 | |
The Minimum Number of Rooks | 有难度的动态规划 | |
Bundling |
| |
Minimizing Maximizer | 01 原则;数据结构优化动态规划 | |
Fixing the Great Wall |
| |
Easy Climb | 需要优化 | |
Blocks | 重点是设计状态及其转移 | |
Integer Transmission | 需要认真思考。可以做到O(n^2)时间。 | |
Compressor | 需要认真思考。很容易写错。 | |
(extra)UVa10949 | Kids in a Grid |
|
(extra)UVa11193 | Infinix |
|
(extra)UVa11194 | Stone Grid |
|
(extra)UVa11810 | Gentle ping, to the old King |
|
红色为已经做了的。。。黄色背景是还有不懂地方,希望在年前能刷完第一章啊。。。。