+ All Categories
Home > Documents > HKOI 2008 FINAL EVENT Q3 STORAGE BOX

HKOI 2008 FINAL EVENT Q3 STORAGE BOX

Date post: 06-Jan-2016
Category:
Upload: bowie
View: 19 times
Download: 0 times
Share this document with a friend
Description:
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. - PowerPoint PPT Presentation
Popular Tags:
14
HKOI 2008 FINAL EVENT Q3 STORAGE BOX Hackson Leung 2007-12-29
Transcript
Page 1: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

HKOI 2008 FINAL EVENT Q3STORAGE BOXHackson Leung

2007-12-29

Page 2: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

AGENDA

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

Page 3: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

STATISTICS

Min = 0 Max = 100 #Max = 3 Mode = 0

Page 4: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

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

Page 5: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

PRE-REQUISITE

Data Processing Simple geometry concept Basic Recursion technique

Page 6: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

WRONG SOLUTIONS

Wrong → 0 marks They contribute to correct solutions

Page 7: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

WRONG SOLUTIONS

Hardcode Remove-all Naïve removal

Page 8: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

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

Target

Intersect

Page 9: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

NAÏVE REMOVAL

Can pass sample I/O Can correctly determine no-removal-case Problem(s)

Easy to construct the sequence? Always correct?

Target

Page 10: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

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 Kth bookThe Pth book

Page 11: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

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?

Page 12: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

OBSERVATION (ADVANCED)

Target

Page 13: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

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?

Page 14: HKOI 2008 FINAL EVENT Q3 STORAGE BOX

POSSIBLE EXTREME CASE

Target


Recommended