Download presentation
Presentation is loading. Please wait.
Published byTobias Dorsey Modified over 9 years ago
1
ACM reminders October 30 -- HMC Mock contest 9:00 - 12:30 November 10 -- regional contest This is the next ACM meeting !! Contest-like problems dynamic programming graph algorithms search and heuristic search geometric problems simulation problems & Algorithms BFS, DFS, branch and bound shortest paths, (max flow) knapsack problem
2
HMC contest When: 9:00 pm - 12:30 am on Tuesday, October 30 Where: here (the graphics lab or in the terminal room) What: 6 problems Rules: only one terminal/keyboard may be used by a team written material and references permitted, but electronic resources or computer files aren’t allowed teams may have 1-4 people & will be graded equally (first three teams of <= 3 students ACM)
3
Next time: contest The following commands will be available in /cs/ACM/bin Submission/Information: acm_submit -- submits a file for testing acm_standings -- gets the current standings + time remaining acm_answers -- prints out written answers & corrections to problems Ask any questions directly. (The reg. contest has a program for this.) When a problem is submitted, we will check it by hand and return one of the following messages Problem correct! Presentation error Wrong output Run-time error Did not compile increasing severity
4
Strategy Look over the problems and decide a rough order of difficulty. When possible, code with someone looking over your shoulder. Trade off the job of writing code to the person most familiar with the problem. You can reuse any code written from the time the contest starts. - you may want to immediately code an I/O skeleton or other routines
5
Scoring a team’s score is two numbers: - solved problems - amount of time rankings are based on the # of solved problems - ties are broken by time (less time is better) time = sum of the # of minutes from the contest start to the solution of each solved problem each incorrect submission of a problem incurs a 20 minute time penalty if that problem is solved Scoring: for example... 2 problems5 hrs. 35 min. submit problem 1 -- incorrect @ 45 min. submit problem 2 -- correct @ 55 min. submit problem 1 -- correct @ 1hr. 15 min.
6
Simulation Problems Problem 1 - faa.cc Basic idea: use radar data to determine how close planes are to one another and print warnings 1 revolution / 4 seconds 0º 75º 270º planeA planeB planeC Radar sweep:
7
Simulation Problems Problem 1 - faa.cc Basic idea: use radar data to determine how close planes are to one another and print warnings 1 revolution / 4 seconds 0º 75º 270º planeA planeB planeC Radar sweep: Input Data 0 planeA 1 10000 0 0 0.2 bearing angle from 0 to 360 plane name horizontal distance (feet) elevation (feet) heading angle from 0 to 360 horizontal velocity (ft/s) ascent velocity (in ft/s)
8
Simulation Problems Problem 1 - faa.cc Basic idea: use radar data to determine how close planes are to one another and print warnings 1 revolution / 4 seconds 0º 75º 270º planeA planeB planeC Radar sweep: Input Data 0 planeA 1 10000 0 0 0.2 75 planeB 5.79 10000 270 0 1 270 planeC 2500 10000 0 0 0.2 END OF INPUT
9
Simulation Problems Problem 1 - faa.cc Basic idea: use radar data to determine how close planes are to one another and print warnings 1 revolution / 4 seconds 0º 75º 270º planeA planeB planeC Radar sweep: Input Data 0 planeA 1 10000 0 0 0.2 75 planeB 5.79 10000 270 0 1 270 planeC 2500 10000 0 0 0.2 END OF INPUT Pairs of planes that will travel within 2500 feet of each other in the next 10 seconds. Output planeB planeA planeC planeB
10
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise
11
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
12
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
13
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
14
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
15
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
16
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
17
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
18
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
19
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
20
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
21
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
22
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
23
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other Input Data top: +1 right: +2 bottom: +4 left: +8 WHEN OPEN 8+2 = A 4 3 A C 4 4 7 D 7 D 1 1 3 A
24
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other Input Data top: +1 right: +2 bottom: +4 left: +8 WHEN OPEN 8+2 = A 4 3 A C 4 4 7 D 7 D 1 1 3 A Output 3 7 C 4 2 E A E C 5 3 E 9 6 9 1 3 A B 8 3 A A 5 4 A E C 4 4 5 1 5 3 B A B 6 C 6 9 1 3 B A 0 Maze 1: The robots do not meet. Maze 2: The robots meet in row 1, column 4. Maze 3: The robots do not meet.
25
ACM reminders October 30 -- HMC Mock contest 9:00 - 12:30 November 10 -- regional contest This is the next ACM meeting !! Contest-like problems dynamic programming graph algorithms search and heuristic search geometric problems simulation problems & Algorithms BFS, DFS, branch and bound shortest paths, (max flow) knapsack problem
26
HMC contest When: 9:00 pm - 12:30 am on Tuesday, October 30 Where: here (the graphics lab or in the terminal room) What: 6 problems Rules: only one terminal/keyboard may be used by a team written material and references permitted, but electronic resources or computer files aren’t allowed teams may have 1-4 people & will be graded equally (first three teams of <= 3 students ACM)
27
Next time: contest The following commands will be available in /cs/ACM/bin Submission/Information: acm_submit -- submits a file for testing acm_standings -- gets the current standings + time remaining acm_answers -- prints out written answers & corrections to problems Ask any questions directly. (The reg. contest has a program for this.) When a problem is submitted, we will check it by hand and return one of the following messages Problem correct! Presentation error Wrong output Run-time error Did not compile increasing severity
28
Strategy Look over the problems and decide a rough order of difficulty. When possible, code with someone looking over your shoulder. Trade off the job of writing code to the person most familiar with the problem. You can reuse any code written from the time the contest starts. - you may want to immediately code an I/O skeleton or other routines
29
Scoring a team’s score is two numbers: - solved problems - amount of time rankings are based on the # of solved problems - ties are broken by time (less time is better) time = sum of the # of minutes from the contest start to the solution of each solved problem each incorrect submission of a problem incurs a 20 minute time penalty if that problem is solved Scoring: for example... 2 problems5 hrs. 35 min. submit problem 1 -- incorrect @ 45 min. submit problem 2 -- correct @ 55 min. submit problem 1 -- correct @ 1hr. 15 min.
30
Simulation Problems Problem 1 - faa.cc Basic idea: use radar data to determine how close planes are to one another and print warnings 1 revolution / 4 seconds 0º 75º 270º planeA planeB planeC Radar sweep: Input Data 0 planeA 1 10000 0 0 0.2 75 planeB 5.79 10000 270 0 1 270 planeC 2500 10000 0 0 0.2 END OF INPUT Pairs of planes that will travel within 2500 feet of each other in the next 10 seconds. Output planeB planeA planeC planeB
31
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other “ro”“bot” clockwise counterclockwise (when there is a choice to be made)
32
Simulation Problems Problem 2 - roandbot.cc Basic idea: to see if two robots navigating a maze end up running into each other Input Data top: +1 right: +2 bottom: +4 left: +8 WHEN OPEN 8+2 = A 4 3 A C 4 4 7 D 7 D 1 1 3 A Output 3 7 C 4 2 E A E C 5 3 E 9 6 9 1 3 A B 8 3 A A 5 4 A E C 4 4 5 1 5 3 B A B 6 C 6 9 1 3 B A 0 Maze 1: The robots do not meet. Maze 2: The robots meet in row 1, column 4. Maze 3: The robots do not meet.
33
Geometric Problems Problem 1 - Binary Space Partitions observer Basic idea: draw objects from far (first) to near (last). z x (0,-big) (100,200) (100,220) (70,200) (70,220) (70,50) (70,70) (40,50) (40,70) (50,220) (50,240) (20,220) (20,240) (-30,210) (-30,230) (-60,210) (-60,230) (-20,60) (-20,80) (-50,60) (-50,80) A B C D E
34
Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 first part
35
Geometric Problems Problem 1 - Binary Space Partitions observer Basic idea: draw objects from far (first) to near (last). z x (0,-big) (100,200) (100,220) (70,200) (70,220) (70,50) (70,70) (40,50) (40,70) (50,220) (50,240) (20,220) (20,240) (-30,210) (-30,230) (-60,210) (-60,230) (-20,60) (-20,80) (-50,60) (-50,80) A B C D E (0,140) (-15,0)
36
Geometric Problems Problem 1 - Binary Space Partitions observer Basic idea: draw objects from far (first -- LEFT) to near (last -- RIGHT). z x (0,-big) A B C D E (0,140) (-15,0) ABCDE
37
Geometric Problems Problem 1 - Binary Space Partitions observer Basic idea: draw objects from far (first -- LEFT) to near (last -- RIGHT). z x (0,-big) A B C D E (0,140) (-15,0) ABCDE (70,150) (-70,150) ABCDE
38
Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 2 0 140 -15 0 70 150 -70 150 first part second part
39
Geometric Problems Problem 1 - Binary Space Partitions Input: 5 4 -50 60 -20 60 -20 80 -50 80 4 -60 210 -30 210 -30 230 -60 230 4 20 220 50 220 50 240 20 240 4 70 200 100 200 100 220 70 220 4 40 50 70 50 70 70 40 70 2 0 140 -15 0 70 150 -70 150 first part second part Output: ECDAB the objects, in the order they would be rendered by this BSP
40
Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2
41
Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2 Suppose you rotate so that left wall right wall floor left wallfloor right wall left wall What is the resulting stacking pattern?
42
Geometric Problems Problem 2 - Visualizing cubes 3 3 1 3 1 2 Suppose you rotate so that left wall right wall floor left wallfloor right wall left wall What is the resulting stacking pattern? 3 2 1 2 1 1 2 1
43
Geometric Problems Problem 2 - Visualizing cubes ?!?
44
All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through nodes {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”
45
All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”
46
All-pairs shortest paths... 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 0 = (d ij ) 0 0813-1 -0-612 -90-- 7-00- ---110 A B C D E D 1 = (d ij ) 1 d ij = shortest distance from i to j through {1, …, k} k d ij = k 0813-1 -0-612 -90-- 7 15 00 8 ---110 A B C D E “Floyd-Warshall algorithm”
47
All-pairs shortest paths... 0813 14 1 -0-612 -901521 715008 ---110 A B C D E D 2 = (d ij ) 2 0813141 -0-612 -901521 7 9 008 ---110 A B C D E D 3 = (d ij ) 3 0813141 130 6 612 22901521 79008 182011 0 A B C D E D 4 = (d ij ) 4 A B C D E D 5 = (d ij ) 5 to store the path, another matrix can track the last intermediate vertex 0812 1 1306612 22901521 79008 182011 0
48
Other STL stuff multimap #include map #include www.dinkumware.com/htm_cpl/index.htmlwww.sgi.com/tech/stl/ set of key/value pairs
49
C++ Map #define MP make_pair typedef pair PII; map m; m[MP(0,1)] = 10; m[MP(0,2)] = 17; m[MP(1,2)] = 5; m[MP(2,0)] = 12; // probably not worth it for graphs... map m; // definitely worth it here m[“ArcOS”] = 110; // as an associative array m[“TheoComp”] = 140; multimap d; // as a dictionary d.insert(MP(“fun”,“c++ coding”)); // methods exist to get d.insert(MP(“fun”,“ACM coding”)); // all of “fun”s entries 0 2 1 10 17 5 12
50
All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm”
51
All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm” D 0 = (d ij ) 0 d ij = shortest distance from i to j through nodes {1, …, k} k d ij = shortest distance from i to j through no nodes 0
52
All-pairs shortest paths A B E D C 8 13 1 6 12 9 7 0 11 0813-1 -0-612 -90-- 7-00- ---110 A B C D E A BC DE from to “Floyd-Warshall algorithm” D 0 = (d ij ) 0 d ij = k d ij = shortest distance from i to j through nodes {1} 1
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.