由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 求问一道动态规划的题目 (转载)
相关主题
一道program challenge的题一道微软题
请教一道面试题请教一个DP的问题
我花了一个小时才调通过这个程序google interview question
问一道算法题这个题咋做?
一道Facebook题如何避免溢出一个Google面试题
生物男的Google面经节略版问道看到的面试题
请教Node.js 应用的安全问题 (转载)问个array in place operation的题目
another google interview question:问几道面试题
相关话题的讨论汇总
话题: squares话题: case话题: test话题: edges话题: integers
进入JobHunting版参与讨论
1 (共1页)
c********l
发帖数: 8138
1
【 以下文字转载自 Programming 讨论区 】
发信人: coupondeal (Coupon Deal), 信区: Programming
标 题: 求问一道动态规划的题目
发信站: BBS 未名空间站 (Mon Apr 28 13:16:18 2014, 美东)
Google code jam上的算法题:
我目前能想到的算法是O(k * 2^n * 2^n)
也就是说,求出所有组合在k=1, k=2, k=3....直到k=k时的最小正方形覆盖
但这个复杂度实在太大了,有没有更简便的算法?
Problem
You are given n points in the plane. You are asked to cover these points
with k squares.
The squares must all be the same size, and their edges must all be parallel
to the coordinate axes.
A point is covered by a square if it lies inside the square, or on an edge
of the square.
Squares can overlap.
Find the minimum length for the squares' edges such that you can cover the n
points with k squares.
Input
The first line of input gives the number of cases, N. N test cases follow.
The first line of each test contains two positive integers n and k. Each of
the next n lines contains a point as two integers separated by exactly one
space. No point will occur more than once within a test case.
Output
For each test case, you should output one line containing "Case #X: Y" (
quotes for clarity), where X is the number of the test case, starting from 1
, and Y is the minimum length for the squares' edges for that test case.
Limits
The points' coordinates are non-negative integers smaller than 64000.
1 ≤ N ≤ 10
Small dataset
1 ≤ k < n ≤ 7
Large dataset
1 ≤ k < n ≤ 15
Sample
Input
2
5 2
1 1
2 2
3 3
6 6
7 8
3 2
3 3
3 6
6 9

Output
Case #1: 2
Case #2: 3
1 (共1页)
进入JobHunting版参与讨论
相关主题
问几道面试题一道Facebook题如何避免溢出
请教软件开发 的 几个面试题!生物男的Google面经节略版
急问一个面试题,不知该如何回答?请高人给个思路!谢谢!请教Node.js 应用的安全问题 (转载)
再上到题another google interview question:
一道program challenge的题一道微软题
请教一道面试题请教一个DP的问题
我花了一个小时才调通过这个程序google interview question
问一道算法题这个题咋做?
相关话题的讨论汇总
话题: squares话题: case话题: test话题: edges话题: integers