CSC 427: Data Structures and Algorithm Analysis
Fall 2004

HW1: C++ Review


For this assignment, you will write a C++ program that utilizes programming techniques and structures from CSC 221 and CSC 222. The design of the program is up to you, but the following general style guidelines apply:

To receive 80% credit on this assignment, you may assume the number of players is limited to 10 and the number of holes is limited to 72. These assumptions enable you to use arrays to store the scores (possibly wasting memory if the actual numbers for an event are smaller). To receive full credit, your program must utilize vectors and dynamically resize the vectors to fit each event.

Note that this assignment is presented in the format of a programming contest problem. As such, input and output formatting is very strict. Be sure that your program meets these specifications exactly.


PROBLEM DESCRIPTION

One of the most popular golf events is the Skins Game, where golfers compete head-to-head for "skins" (and each skin is worth a certain amount of money). Each hole on the golf course is worth a skin. If one of the golfers shoots a score on a hole that is lower than all the other golfers, then that player wins the skin for that hole. If there is a tie for the low score on that hole, then nobody wins the skin and it carries over to the next hole. That is, the winner of the next hole (whoever that may be) wins 2 skins. Of course, there might be a tie on the next hole as well, in which case the skins keep adding up until someone wins a hole.

You are to write a program that processes some number of Skins Games, repeatedly reading in player scores from a file and displaying the number of skins won by each player. Note that the number of golfers and holes played may vary from event to event. Also, it is possible for the event to conclude with unclaimed skins. If this should occur, your program should display the number of unclaimed skins after the last hole.

INPUT SPECIFICATION

The input will be read from a file named "scores.dat." The first line of the file contains a positive integer specifying the number of events to be read and processed. The data for each event consists of five lines, with the first line containing the number of players (P) followed by the number of holes played (H). The next P lines each consist of H integers, with the integers on the first line representing the scores for player 1 (first score is hole 1, second score is hole 2, etc.), the integers on the second line representing the scores for player 2, etc. You may assume that P and H are both greater than 0.

OUTPUT SPECIFICATION

For each event, you should output the event number as well as the number of skins won by each player. If there are any skins remaining after the last hole, your program should display this number. The output format should be as below (note the correct plurality of SKIN/SKINS).

SAMPLE INPUT

2 4 18 3 4 5 5 4 6 4 3 5 6 4 4 7 6 6 4 4 5 4 4 4 4 4 5 4 2 4 4 4 4 6 6 6 4 4 4 3 3 4 4 4 4 4 3 4 6 5 4 5 5 7 4 4 5 5 4 6 5 4 6 4 3 4 5 6 4 7 5 5 4 4 6 2 9 3 4 5 5 4 6 3 2 4 4 4 5 4 4 5 4 3 4

SAMPLE OUTPUT

EVENT 1 PLAYER 1: 0 SKINS PLAYER 2: 7 SKINS PLAYER 3: 9 SKINS PLAYER 4: 2 SKINS EVENT 2 PLAYER 1: 3 SKINS PLAYER 2: 5 SKINS UNCLAIMED: 1 SKIN