: v ^, 13 characters (Steven Hao) "#>56++v,:|"> : v ^, 13 characters (Steven Hao) "#>56++v,:|">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Break; return; // to school :’(. PotW Solution Problem recap: Write a Befunge program that prints out a Brain**** program that prints out a HQ9+ program.

Similar presentations


Presentation on theme: "Break; return; // to school :’(. PotW Solution Problem recap: Write a Befunge program that prints out a Brain**** program that prints out a HQ9+ program."— Presentation transcript:

1 break; return; // to school :’(

2 PotW Solution Problem recap: Write a Befunge program that prints out a Brain**** program that prints out a HQ9+ program that prints out “Hello, world!”. o HQ9+ program output by Brain**** program is “H” o Brain**** program output by Befunge program may be ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++. (including the dot at the end; there are different ways to write this program but this is the simplest) o Many ways to approach Befunge program

3 Example Solutions 20 characters (Andrew Wang) 89* v,"+"-1_v#:< ". ", @ 19 characters (Tony Jiang) 89*>: v ^, "+"-1_".",@ 13 characters (Steven Hao) "#>56++v,:| > @

4 Announcements ProCo on May 26, 8AM – 5PM o Registration is “temporarily full” until more space is found, but there’s a waiting list you can sign up for at http://proco.stanford.edu.http://proco.stanford.edu US Open/USACO results o Congratulations to Steven Hao and Johnny Ho for placing 2 nd and 3 rd in the country for US Open Gold division! o Lynbrook students did very well in this year’s overall USACO rankings! (Johnny Ho 1 st in Gold, Steven Hao 9 th in Gold, MG Chi 19 th in Gold, Qingqi Zeng 2 nd in Silver, Karen Ouyang 4 th in Silver, Julia Huang 18 th in Silver) o Kudos to everyone who consistently participated in USACO this year! USACO Finalists o Special congratulations to Steven Hao for qualifying for the USACO camp! o Oh, and Johnny too.

5 Officer Applications This year’s officer application will be made available today! o Check the website (http://lynbrookcs.com); also will be emailedhttp://lynbrookcs.com Due on Monday, May 14 at 11:59:59 PM o Results will be announced on Monday, May 23 Same officer positions as this year: o 1 president o 1 vice president o 1 secretary o 1 treasurer

6 US Open Let’s have a look at some of the problems!

7 Bronze – Three Lines Given a set of up to n <= 50000 cows on the X-Y plane with integer coordinates, determine if it is possible to cover all the cows with three horizontal or vertical lines. Create “histogram” of how many times each distinct y- coordinate appears as well as how many distinct y- coordinates there are o Coordinates may have to be “compressed” first: normalize the coordinates to be within the range [0, N) (or use HashMap) Check 4 cases of what points can be covered by: o 3 horizontal lines: Passes if number of distinct y-coordinates is as most 3 o 2 horizontal, 1 vertical: Sort points on x, for each distinct x-coordinate remove all points with that x-coordinate (simulating vertical line there), test if number of distinct y-coordinates drops to at most 2 o Other two cases identical to these two, except swap “x” and “y”

8 Silver – Unlocking Blocks Given the shapes and locations of three objects (represented as series of the coordinates for the individual boxes that form the shapes), determine the minimum number of slides (one object moved one tile north, east, south, or west) needed to separate the blocks (bounding boxes no longer overlap).

9 Silver – Unlocking Blocks Use depth/breadth-first search: find path from initial state to state w/ disjoint bounding boxes o Since we are not looking for any particular path, any of these graph search algorithms works Represent state with 4 integers (x and y offsets of objects 2 and 3 from their original positions) o Each move consists of adding/subtracting 1 from one of these numbers, or adding/subtracting 1 from both x-coordinates or both y-coordinates (representing object 1 being moved) DFS/BFS may quickly branch out but objects and coordinates are small so it’s okay

10 Gold – Tied Down Gold – Tied Down Given n <= 10 poles stuck in the ground and a string that wraps around them, find the minimum number of poles that must be removed before the string can be untangled o Obviously, the string cannot pass through poles unless they are removed o The poles are conveniently all on the same line (same x-coordinate) Try removing all 2 10 subsets of the poles o Find y coordinates of intersections between the string and the line o Use a stack to simplify the crossings as you traverse the string o If a string crosses across one portion of the line and then immediately returns across the same portion, the string will then unwrap o If the stack is completely emptied by the time the entire string has been traversed, the string can be untangled

11 Gold – Tied Down Gold – Tied Down

12 PotW No PotW this week – study for AP exams if you’re taking any! (or finish that AP Lit research paper…) The Befunge problem marks the last PotW of this school year (or does it?)


Download ppt "Break; return; // to school :’(. PotW Solution Problem recap: Write a Befunge program that prints out a Brain**** program that prints out a HQ9+ program."

Similar presentations


Ads by Google