Notes

I saw a poster for the ACM programming tryouts. I'm really rusty, but
it would be good for me to find other geeks and learn from them. =)
Besides, I'm curious about their training. Will I qualify, though? I'm
not sure if my one class in an MAEd counts. I need less than 5 years
of post-secondary studies. Ack, ack, ack.

All those compile errors for Java... <grumble> I'm sticking to
that language out of principle and because our students will probably
submit using it, so I need to demonstrate that almost all the problems
are easily doable in Java.

I had to rewrite the Australian Voting solution several times to get
it to pass the weird mix of Java 1.1 and 1.2 on http://acm.uva.es . I
suspect my final implementation is actually better, but still...

Scratch

store the declarations in a vector, then have a method evaluate variables or throw an exception

197

cube

brute force, then check if rotated already?

196

spreadsheet

easy

195

anagram

straightforward lexicographic non-repeating permutation

194

triangle

relatively straightforward mathematics

193

graph coloring

a bit more complicated. white nodes can be adjacent. brute force? start with a black node, then add nodes that are connected to the graph, flipping the colors if necessary. If this results in more black nodes than previous configuration, mark this node as black and keep configuration, else mark this node as white. Greedy.

192

synchronous design

look for cycles, check for delays. can find cycles when calculating delays. Start with nodes directly connected to input, have time associated with each node.

191

intersection

straightforward geom problem. just check if any of the lines that form the rectangle intersect with the line segment, or the line segment is completely contained within the rectangle. even easier because rectangle is parallel to axes.

190

circle through three points

find the point of intersection of two normals at the halfway point.

189

pascal program lengths

just tokenize properly. stream?

188

perfect hash

haven't thought about this much

ACM ICPC Finals 2003

Problem A: building bridges

Ideas:

Label all the buildings. Create a graph of the possible bridges.
Test for disconnections. If there are subgraphs that cannot be
connected (it's like a rook problem), then consider them on their own.
Then do an MST for each subgraph.

Problem B: light bulbs

Ideas:

We solved the 5x5 puzzle before by brute-forcing the whole thing, but
with the inputs as 100-digit-long decimal strings, I'm not sure if
that's feasible. You are, after all, talking about 10^100, which is a
heck of a lot of bits long. So we may actually be forced to find an
elegant solution.

If this is the same as the 5x5 puzzle, then we don't have to worry
about the minimum number of lights that need to be flipped; there is
only one solution, if there is a solution.

Subproblems:

Convert long integers to binary. Java!

Exploit parity. If I decide what to do with the first bit, then all
the rest of the bits follow, because I just flip according to the
thing I'm currently examining. So there are actually only two cases,
and both are checked when I hit the end.

Lovely, that. We'll try it out.

Problem J: toll

This looks like a straightforward greedy graph problem at first
glance, but since the number of items at the start is variable, it's
actually a bit harder. Ideas? Let's see.