1 / 14

HKOI 2008 FINAL EVENT Q3 STORAGE BOX

HKOI 2008 FINAL EVENT Q3 STORAGE BOX. Hackson Leung 2007-12-29. AGENDA. Statistics Problem Descriptions Pre-requisite Wrong Solutions “Correct” Solutions Correct Solution(s) Discussion. STATISTICS. Min = 0 Max = 100 #Max = 3 Mode = 0. PROBLEM DESCRIPTIONS.

bowie
Download Presentation

HKOI 2008 FINAL EVENT Q3 STORAGE BOX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HKOI 2008 FINAL EVENT Q3STORAGE BOX Hackson Leung 2007-12-29

  2. AGENDA • Statistics • Problem Descriptions • Pre-requisite • Wrong Solutions • “Correct” Solutions • Correct Solution(s) • Discussion

  3. STATISTICS • Min = 0 • Max = 100 • #Max = 3 • Mode = 0

  4. PROBLEM DESCRIPTIONS • Given N books (by means of their co-ordinates) • Find the optimal way to remove books such that the Kth book is not covered by any book • The sequence of removal is important Target

  5. PRE-REQUISITE • Data Processing • Simple geometry concept • Basic Recursion technique

  6. WRONG SOLUTIONS • Wrong → 0 marks • They contribute to correct solutions

  7. WRONG SOLUTIONS • Hardcode • Remove-all • Naïve removal

  8. NAÏVE REMOVAL • Project two vertical lines from two sides of the book • Whenever the lines intersect (not touch) any book that is higher than the target, it should be removed Intersect Target

  9. NAÏVE REMOVAL • Can pass sample I/O • Can correctly determine no-removal-case • Problem(s) • Easy to construct the sequence? • Always correct? Target

  10. OBSERVATIONS • The books covering the Kth book are also removed • Suppose one of them is the Pth book • If the Pth book is optimally removed, then the Kth book is also removed optimally • The problem becomes: how to remove the Pth book in the optimal way? The Pth book The Kth book

  11. CORRECT SOLUTION • From previous slide, it seems that we are doing the same job again and again • Unless the top objects are not removed, the one below should remain stationary • First-In-Last-Out (FILO) property holds • Why not use recursion to solve? • Θ(N2), fast enough for N < 1,000 • Way to improve?

  12. OBSERVATION (ADVANCED) Target

  13. COMMON MISTAKES • Correct source, wrong executable • Wrong determination of “covering” • Poor implementation skills in recursion • Wrong concept in local / global variables • Wrong output sequence • Does the sequence always follow FILO property?

  14. POSSIBLE EXTREME CASE Target

More Related