Topcoder SRM 583; Depressing

I can safely say I knew correct solutions to all of the three problems in this SRM. I solved easy problem lightening fast. Medium was an implementation problem, with quite a few corner cases, but nothing too tricky. It took me a good amount of time, so that I had little time for hard problem. I knew hard problem was finding maximum cost from each point, to any other point, and returning minimum of it. But I couldn’t implement it in time.

That’s not it though. My medium failed. With one of the most stupidest mistakes ever. I was indexing an array of mine with an input that was 1-indexed, while my array was 0-indexed. All I had to do was to subtract 1 from the input before passing it to array as an index, and my solution passes. :(

DIV2-Easy; SwappingDigits:

All we need to do is swap digits at each pair of indices into the string, and see if it produces minimum integer with no leading 0.

DIV2-Medium; IDNumberVerification:

An implementation problem. Check that each part of the ID is valid, and then return gender of the person.


Sad SRM. But meh! Happens.