Tuesday 2 July 2013

OMG Informatics

I often struggle at writing introductory paragraphs. This is the end of my introductory paragraph.

By far, the most important part of the day is breakfast, and it only makes sense to start with that. I had toast, eggs, baked beans and coco pops. It was pretty swell.

Then came the daily exam, which featured the tasks of day 2 of the Baltic Olympiad in Informatics (we did day 1 yesterday). According to Jarrah, the scores we achieved were all medal-winning scores, which is promising.

Then came lunch. I used the AMT free money to get chicken and chips from the UNSW food court. It was pretty swell.

Then came the problem session, where we discussed the problems from today's exam. Some of the solutions were pretty crazy, particularly the solution to the last question.

And just now I discovered something ~AMAZING~. Scanf is really, really slow. Like stupidly slow. Like one of my solutions to a particular problem was timing out. This is because scanf assumes you're in a multi-threaded environment, so it has to wait for the input stream to be readable and put a lock on it and whatnot. This is silly, because in informatics we aren't allowed to use multiple threads. What we use instead is a super cool function called getchar_unlocked. It doesn't wait for threads or put locks on things. It just reads in a character like a boss. This took a particular case from 0.5s to 0.2s, which is pretty swell.

And now we are about to have pizza for dinner. It should be pretty swell.

No comments:

Post a Comment