340 likes | 456 Views
Programming Contests. The agony and the ecstasy. Guiding Principle. You are only as good as the set of problems that you can solve. You can solve a problem if you HAVE solved it. Brief History.
E N D
Programming Contests The agony and the ecstasy
Guiding Principle • You are only as good as the set of problems that you can solve. • You can solve a problem if you HAVE solved it.
Brief History • The ACM International Collegiate Programming Contest, ICPC, traces its roots to a competition held at Texas A&M University in 1970 hosted by the Alpha Chapter of the Upsilon Pi Epsilon Computer Science Honor Society (UPE). The contest evolved into its present form as a multi-tier competition in 1977, with the first finals held in conjunction with the ACM Computer Science Conference. • (ACM student leaders, others, think about a UPE chapter at UTD).
Contest Format • One computer, three students, five hours, 8-10 problems. • Usually a Linux based OS with the PC^2 online submission system. • Multiple IDEs, editors. • Java, C/C++
The ACM ICPC South Central Regional • Each year in November 60 – 80 teams compete in the 3-state (TX, LA, OK) Regional Contest. Worldwide, over 6000 teams from 1800 universities in 82 countries compete in their local Regional Contests. • Depending on the number of teams competing at our Regional Contest, one or two teams go to the World Finals.
UTD’s success • We’ve been competing for over 10 years. Here are our best team placements for the past 9 years in the ACM South Central Regional Contest: • 2000: 7th 2005: 2nd • 2001: 4th 2006: 1st • 2002: 13th 2007: 14th • 2003: 4th 2008: 5th • 2004: 13th 2009: 10th
The 2009 South Central Regional Results 73 teams competed
World Finals • The World Finals have been held in Hawaii, St. Petersburg Russia, Berverly Hills CA, San Antonio TX, Shanghai China, Prague The Check Republic, Tokyo Japan, Vancouver Canada, Stockholm Sweden, Banff Canada, and this year they will be held at Harbin University, China.
UTD Heroes 1999: A group of UTD students take a Greyhound Bus to Baton Rouge to compete in the the ACM ICPC Regional Contest at LSU. It’s raining when they arrive. They call LSU and get an IT technician to give them a ride to the university. They sleep on the floor in Coates Hall at LSU and compete the next day. With no coach, they cannot officially compete. They don’t even stay for the banquet and results – they have to catch the bus back to Dallas. Their story becomes a legend of the LSU Regional Contests and is still told by the Contest Organizer at LSU.
My Role 2000: Students ask me to coach them. I begin holding local contests at UTD and taking 3 teams to LSU. We fly to Baton Rouge, once in a prop plane. We fly to New Orleans and drive 60 miles. We drive all the way. The reward for taking part? I take the teams to Bourbon Street after each contest. 2006-2009: Regional contests go distributed and we compete at UT Arlington, East Central Oklahoma U, Baylor U, Le Tourneau U, resp.
The Dream Team is Formed 2005: Hurricane Katrina devastates LA. The number of contestants is way down in our region. Matthew Dempsky and Michelle Berger, together with one other, compete at LSU and get 2nd place. We were the top placed team in the world not to go to the World Finals (held in San Antonio, TX.) 2006: Jack Lindamood joins UTD as a MS CS student. He competes in my local UTD contests as a team of 1. Matthew and Michelle compete as a team of 2. The 2 teams alternate winning. I put the three together and they win the Regional Contest that year.
The Glory Year • 2007: Jack, Matthew and Michelle get 14th place in the World Finals in Tokyo – the highest place so far for any team from our region, 3rd among USA teams, 5th among North and South American teams. • The TX house of Representatives passes a resolution in honor of our team’s success (motion made by Fred Hill)
The Problems • There are literally thousands of problems at many web archives. And there are many automatic online judges that will try your solutions and keep statistics of your successes. • We will consider just a few.
Scope of the Problems • Arithmetic, modulo arithmetic, number theory, combinatorics, probability theory, algebra, trees, graphs, mechanics, geometry, data structures. • Programming styles: Brute force, backtracking, greedy methods, divide and conquer, dynamic programming. • The book: Programming Challenges, Steven S. Skiena, Miguel A Revilla, Springer. • The way to learn: Join Codeburners and Compete.
Common Permutation: UVa 10252 • Given two strings of lowercase letters, a and b, print the longest string x of lowercase letters such that there is a permutation of x that is a subsequence of a and there is a permutation of x that is a subsequence of b. • Sample Input Sample output the etstreet
Stack of Flapjacks: UVa 120 • Given the diameters of flapjacks in a pile, short them into size order, smallest at the top, using a minimum number of flips: • Flip: Insert a spatula somewhere in the pile and flip the pile of those above the spatula:2 3 13 -> 2 -> 2 1 1 34 4 4
Vito’s Family: UVa 10041 • Vito has a very big family, all living in Lamafia Avenue. He is trying to find a house close to all of them. Vito wants to minimize the total distance to all of them and wants you to write a program to find a location for him to live. He might have to move in with a relative. The houses are equally spaced with addresses 1,2,3,. . . • You are given a list of addresses (house numbers) of his relatives. Several may live at the same house.
The Trip: UVa 10137 • A number of students take a trip together. They agree in advance to share expenses equally, but it is not practical to have them share every expense as it occurs. After the trip, each student's expenses are tallied and money is exchanged so that the net cost to each is the same, to within one cent. • Compute, from a list of expenses, the minimum amount of money that must change hands in order to equalize (within a cent) all the students' costs.
Cutting Sticks: UVa 10003 • You have to cut a stick into pieces. The cost of a single cut is equal to the length of the stick being cut. The order in which cuts are made affects the total price: consider a stick of 10m that is to be cut at 2m, 4m and 7m from one end. • Cut first at 2, then 4, then 7: price = 10 + 8 + 6 = 24 • Cut first at 4, then 2, then 7: price = 10 + 4 + 6 = 20. • Find an ordering for the cuts that minimizes price.
Dividing Coins: UVa 562 • Given a list of of up to 100 coins, each of value in [1,500], (there can and will be repeated values) divide the coins into 2 piles such that the value difference is minimized. • For example, given the set 1, 1, 2, 3, 100, the best partition is [1,1,2,3], [100], giving a value difference of 100 - 7 = 93.
Tug of War: UVa 10032 • A tug of war is to be arranged. The athletes must be divided into two teams. The memberships of the two teams must not differ by more than 1. The total weights of the two teams should be as nearly equal as possible. • Input: an unordered sequence of weights. Output: the total weights of the two teams:Sample Input: Sample Output: 100 190 20090200
Bigger Square Please: UVa 10270 Tommy has many paper-squares of each size from 1 to N-1. He wants to make a square of size N by tiling the NxN space with as few of his squares as possible. For example. A square of size 7 can be made up with 9 smaller squares, shown below. (See http://www.squaring.net/history_theory/brooks_smith_stone_tutte_II.html Or Google Mrs Perkin’s Quilt)
2 2 3 1 1 2 1 4 3
“YO” from the 2009 Regional Given a starting word and a dictionary, determine how many ways you could "paint over" combinations of letters in the starting word and end up with one or more correctly spelled words from the dictionary. If a "paint over" combination produces multiple words (including the same word appearing at multiple locations in the starting word), then it is counted separately from the combinations that produce individual words. Multiple words need not be separated, and a single word may contain embedded spaces.
More YO • For example, if the dictionary contains "he" and "vet" and the starting word is "CHEVROLET", then four possible combinations can be produced: • .HE......, .H.....E., ...V...ET, .HEV...ET • However, multiple words may not overlap each other in any way. For example, the starting word "CHEVROLET" can form individual words "hoe" and "vet", but the combination of both words would not be valid.
Even more YO Sample Input: Sample Output: 2 2 2 TOYOTA 2 toyyo5 CHEVROLET does he like her program
The Next UTD Contest • We will have a 3-hour “sprint, pre-Superbowl” contest on Saturday, February 6th, from 1p – 4p, in the main computer lab on the ground floor of ECSS. • Teams of 1, 2, or 3 may compete. Bring paper, pencils, pens, text books, and notes, but do not bring any recording media, such as thumb drives, data CD’s etc. (You can bring music CD’s, iPods, etc for listening to music) You must not download or cut and paste any part of your solutions from the web. • Each team gets ONE computer. Problem sets will be distributed on paper. Judging will be online and fast.
Codeburners • To join, go to http://groups.google.com/group/code-burners?hl=en • Or Go to my website, www.utdallas.edu/~ivor and click on the link to join Codeburners. • Codeburners has 210 current members. • UVa online judge:http://uva.onlinejudge.org/index.php