May 1, 2002 Lessons Learned the Hard Way This is the first of what hopefully will develop into a regular review of division 2. The focus will be on "what went wrong". We hope to provide a statistical breakdown in the future, but this has not been finalised yet. SRM 85 had 660 entrants. In the end, there were enough coders to create some 43 rooms in Division 2. As a landmark, it was the first match to allow submission in C#. The first 2 problems on the division 2 problem slate were straightforward: if you could do the problem, there was a very high likelihood that it was correct. My room had only 2 challenges, some others had none. The top 2 rooms of the division each had only 1 solution fail. The third problem was trickier, but the problem complexity seems to have stopped submission of weak solutions. Level One - 250: Level Two - 500: The solution was simple: search each block of 3 in each position. A variant on this was to keep a "starcount" of the number of '*' characters, to help in identifying cases. A third variant counted the number of pairs of equal characters. It was noticeable that the solutions which failed were distinctly "uglier" than average. The counting methods were fairly unreliable. Level Two - 100: It's hard to analyse where a lot of these problems went wrong, because of the complexity of the rules. Probably, only getting out a debugger. Member Comments In the article on Div2 there is a case in the Rules for level two that fails. '*aa" would drop out of the ifs. I can't figure out if these 4 rules are meant to be complete, but at the least it is confusing, and probably not the most readable way of doing the problem. The two variants I would choose would be
1. a == '*' && b == '*'; return c; this separates the two aspects of the problem hence increasing readability or
1. a != '*' && (a==b || a==c || (b == '*' && c == '*')); return a; this gives a fall through on what will produce each result. As a more instructive way of solving the problem I would make: 3. c != '*' && (b == '*' && a == '*'); return c; as this shows a trend of the equalities decreasing, and improves coder's ability to see patterns and analyse problems. Other than that an excellent article that should be continued. He also forgot to mention the approach to sort each triple first (I've also put this into practice room 109):
string handle ( string t ) { Problem Set Analysis & Opinion Div. 2 - Easy: Evil Would be nice to also mention these two variants to count the number of bits:
int bitCount ( int n ) {
int bitCount ( int n ) { I got the first variant from the book "The C Programming Language" by Brian Kernighan and Dennis Ritchie. Stefan |
|