UVa 893: time limit exceeded