Top Banner
Programming Contests The agony and the ecstasy
34

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.

Mar 30, 2015

Download

Documents

Edgardo Hamblet
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 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.

Programming ContestsThe agony and the ecstasy

Page 2: 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.

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.

Page 3: 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.

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).

Page 4: 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.

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++

Page 5: 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.

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.

Page 6: 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.

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

Page 7: 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.

The 2009 South Central Regional Results

Number of Problems solved

Number of Teams

7 1

6 1

5 1

4 5

3 4 UTD solved 3

2 7

1 10

0 44

73 teams competed

Page 8: 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.

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.

Page 9: 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.

Winners, top US Teams:Year Winner Best Placed

US teamBest placed team from our region

2000 St. Petersburg UITMO

California IT, 9th UT, HM

2001 St. Petersburg UITMO

Virginia Tech, 2nd

UT, HM

2002 Shanghai Jiao Tong

MIT, 2nd UT, 27+

2003 Warsaw, Poland California IT, 13th

UT,21+

2004 St. Petersburg UITMO

MIT, 5th TAM, HM

2005 Shanghai Jiao Tong

U of Illinois, 17th

UT, HM

2006 Saratov State MIT, 8th Rice, HM

2007 Warsaw, Poland MIT, 4th UT Dallas, 14th

2008 St. Petersburg SU MIT, 4th UT, HM

2009 St. Petersburg SU MIT, 7th UT, 49+

2010

Page 10: 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.

Big WinnersWins

Institution Most Recent

3 Saint Petersburg University of Information Technologies, Mechanics and Optics

2009

3 Stanford University 1991

2 University of Warsaw 2007

2 Shanghai Jiao Tong University 2006

2 Saint Petersburg State University 2001

2 University of Waterloo 1999

2 California Institute of Technology 1988

2 Washington University in St. Louis 1980

Page 11: 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.

Winners By CountryWins Country Most Recent

17 USA 1997

6 Russia 2009

2 Poland 2007

2 China 2005

2 Canada 1999

1 Czech Republic 1998

1 Germany 1995

1 Australia 1992

1 New Zealand 1990

Page 12: 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.

2007, Tokyo: Getting Ready!

Page 13: 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.

The UTD Dream Team

Page 14: 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.

The 2007 Winners from Warsaw

Page 15: 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.

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.

Page 16: 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.

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.

Page 17: 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.

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.

Page 18: 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.

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)

Page 19: 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.

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.

Page 20: 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.

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.

Page 21: 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.

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

Page 22: 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.

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 -> 21 1 34 4 4

Page 23: 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.

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.

Page 24: 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.

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.

Page 25: 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.

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.

Page 26: 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.

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.

Page 27: 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.

Tug of War: UVa 10032o 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.

o Input: an unordered sequence of weights. Output: the total weights of the two teams:Sample Input: Sample Output: 100 190 20090200

Page 28: 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.

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)

Page 29: 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.

2 2

1

1

2

1

3

4

3

Page 30: 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.

“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.

Page 31: 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.

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.

Page 32: 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.

Even more YO

Sample Input: Sample Output:

2 2 2 TOYOTA 2 toyyo 5 CHEVROLET does he like her program

Page 33: 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.

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.

Page 34: 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.

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