2007 South Central USA Regional Programming Contest Solution Report
I. Official site:
II. Solution report:
1. One is an Interesting Number
Do it directly according to the problem description. You could preprocess the square number, cube number, quad number less that one million,
and avoid float calculation if possible.
2. Verdis Quo
Convert roman number to decimal. Be aware of the case a[i]<a[i+1].
3. The Screen Behind the Mirror
Nice geometry problem. The knowledge we should look into includes solving the point of intersection between one ray and one segment AND
the angle after reflection. The former could be settled by using parameter equation, and the latter could be done by breaking up the vector into the horizontal direction and vertical direction, (See the details in this site http://www.geometryalgorithms.com/Archive/algorithm_0104/algorithm_0104B.htm). We should first calculate which object the incidence ray meets, and then get the result recursively.[BTW: Writting sth in the style of class seems nice sometimes]
4. Another Brick in the Wall
By adding the source vertex S, sink vertex T, we first constract one bidirectional graph in which the weight of vertex S and other vertexes in the first row is always one, the weight of vertex T and other vertexes in the last row is always zero. Every vertex is connected with its neighbour vertexes, and the weight is one if their values are different, and zero vice versa. The weight of non-connected vertexes is set to INF.
The result is the shortest path betwwen S and T.
5. The Sidewinder Sleeps Tonite
This problems needs three steps to complete.
The first step is to judge whether one figure is closed or not, the solution is to see the degree of each '#', any value except for zero and two is incorrect(there is still one thing to mention that there maybe some cases that the upper character of '#' is '-' while the lower character of '#' is '|'. It seems that the test data does not included this kind of case. But I do recommend to think about it); The second step is to check whether ths digit in the input is correct, this could be done similarly by using the method stated above; The last step is to check whether the closed figure is the only one, we can using depth first search along one edge. And check all the edges to see whether they are all marked. Also I
recommend to validate the closed figure.
6. Rout 66
Naive problem
7. Schottkey 7th Path
A little complexed string processing problem, I use map<string, vector<string> > for convenience
8. Another Version of the Truth
I thought it was a game theory problem...
We could first preprocess the nearest distance from each point to the plays. Then we use O(D*D) to enumerate the free postion, bfs again and to get the optimal result. The complexity I wrote is O(D4*P2), however we could improve it to O(D4*P). The reason is that we could calculate the increased INFLUENCE number directly and no need to compare with other players.
9. The Final Countdown
There is one trick in this problem that the Countdown time could be larger that the Start time.
The solution is to store every true and false condition case's holdtime and add the minimum and maximum value to the result respectively.