【POJ 3514】[NEERC2006] Graveyard

题目传送门:http://poj.org/problem?id=3154
中文题面:《算法竞赛·入门经典·训练指南》P7

作为一道很有趣的贪心,我居然只会O(n^2)的DP
真是惭愧……..
下面说正经事:

引理一:

一定存在一种最优方案,使得至少有一个最终的雕塑位置与原位置重叠

证明:

考虑每一个原的雕塑位置
设最近的最终雕塑位置在顺时针方向的点集为A
设最近的最终雕塑位置在逆时针方向的点集为A
1)|A|==|B|:显然将距离最终雕塑位置最小的点移动过去不会使答案变劣
2)|A|<|B|:显然逆时针转动尽量小的距离,使得有一个原雕塑与最终雕塑位置重叠会使答案变优
3)|A|>|B|:同理可得:应顺时针转动最小距离

引理二:

不会有两个原雕塑位置离同一个最终雕塑位置最近

证明:

设原雕塑间隔为A,最终的雕塑间隔为B
若两个原雕塑位置离同一个最终雕塑位置最近,则这两个原雕塑间的距离小于B(类比四舍五入)
但由题意得:A < B
矛盾,所以这种情况不可能发生

证明了这两个引理之后,就可以贪心啦!
随便定一个点,然后将每个原雕塑位置移动到最近的最终雕塑位置即可

38 thoughts to “【POJ 3514】[NEERC2006] Graveyard”

  1. 596374 164870Youre so cool! I dont suppose Ive learn anything like this before. So good to discover any person with some authentic thoughts on this topic. realy thank you for starting this up. this website is something that is wanted on the internet, someone with just a little bit originality. helpful job for bringing something new towards the web! 239486

  2. 150479 151174I only wish that I had the ability to convey what I wanted to say in the manner which you have presented this information. Thanks. 468343

  3. 806018 435259The specific New york Diet can be an highly affordable and versatile eating much better tool built for time expecting to loose fat along with naturally keep a healthful day-to-day life. la weight loss 170725

  4. 540008 620224I just could not go away your web site before suggesting that I extremely enjoyed the usual info a person supply to your guests? Is going to be back ceaselessly as a way to inspect new posts. 289660

  5. Hmm it looks like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say,
    I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but
    I’m still new to the whole thing. Do you have any points for inexperienced blog
    writers? I’d really appreciate it.

  6. Its like you learn my mind! You seem to grasp so much approximately this, such as you wrote the
    e book in it or something. I feel that you could do with a few
    p.c. to force the message house a little bit, but other
    than that, that is wonderful blog. A great read.
    I’ll definitely be back.

  7. Hi, I believe your website could be having browser compatibility problems.
    Whenever I look at your site in Safari, it looks fine however, if opening
    in Internet Explorer, it has some overlapping issues.
    I merely wanted to give you a quick heads up! Apart from that, excellent blog!

  8. Greetings! This is my first comment here so I just wanted to give a quick shout out and
    tell you I truly enjoy reading your posts. Can you recommend any other blogs/websites/forums
    that cover the same subjects? Thank you!

  9. Great work! This is the kind of information that are supposed to
    be shared around the internet. Shame on Google for no longer positioning this put up upper!

    Come on over and talk over with my website . Thank you =)

  10. I really like your blog.. very nice colors & theme.
    Did you create this website yourself or did you hire someone to do it for you?
    Plz answer back as I’m looking to design my
    own blog and would like to find out where u got this from.
    kudos

  11. Your style is really unique compared to other folks I’ve read stuff from.
    I appreciate you for posting when you’ve got the opportunity,
    Guess I will just book mark this page.

  12. Hello there! I know this is kind of off topic but I was wondering
    if you knew where I could locate a captcha plugin for
    my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one?

    Thanks a lot!

  13. Hello, you used to write wonderful, but the last few posts have been kinda boring?K I miss your great writings. Past few posts are just a little out of track! come on!

  14. Wow that was odd. I just wrote an really long comment but after I clicked submit
    my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyway,
    just wanted to say fantastic blog!

  15. I like the helpful info you provide in your articles.
    I will bookmark your weblog and check again here regularly.
    I am quite certain I will learn many new stuff right here!
    Good luck for the next!

  16. It’s truly very difficult in this full of activity life to listen news on TV,
    therefore I just use the web for that reason, and take the latest news.

  17. Pretty great post. I just stumbled upon your blog and wanted
    to mention that I have really loved surfing around your
    weblog posts. In any case I will be subscribing for your rss feed and
    I am hoping you write again soon!

  18. I’m not that much of a online reader to be honest but your
    blogs really nice, keep it up! I’ll go ahead
    and bookmark your website to come back later on. Cheers

  19. I just like the helpful information you supply for your
    articles. I’ll bookmark your blog and check again right here frequently.
    I am fairly sure I’ll be informed a lot of
    new stuff right here! Good luck for the next!

  20. Have you ever considered creating an ebook or guest authoring on other websites? I have a blog based on the same information you discuss and would love to have you share some stories/information. I know my readers would appreciate your work. If you are even remotely interested, feel free to shoot me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *