The Uk and Ireland Programming Competition is back, or was back.
This year we had 5 teams of three students attacking 14 algorithmic puzzles with the aid of just one computer and no internet! You can see them hard at work in the picture above, approximately mid contest.
This was our most successful year as you can see from the scoreboard with programming competition veteran team Flight Mode managing to snag 56th place out of 184 teams by solving 5 puzzles. That puts them in the top 30%. Fantastic well done to them.
In fact well done to all of the teams. It was great that all of the teams managed to solve at least one of the puzzles. Also interestingly, it wasn’t all the same puzzles.
I also had a brief play with one of the puzzles, puzzle D. I got my algorithm in place fairly quickly, and it passed the provided sample tests. However, I was failing the hidden tests. As I wasn’t taking part competitively, I had a quick chat with the two teams that had solved it already to see whether I was missing anything in my interpretation. Their algorithm was slightly different (and more complicated) but amounted to the same thing. So why did theirs pass and mine didn’t? The answer, which came to me whilst walking down the corridor to do something else, was that my integers were overflowing. The hidden test set was using large numbers, and when they had to be summed, they became to big to fit in a standard integer. Once I changed my variables to long unsigned I got the pleasing green box that signified an accepted solution.
So, why didn’t the other teams note this gotcha to me? They were using Python, and I was using C++. Their untyped variables were automatically using the largest int size, or at least according to my quick Google (Python is not a language I am particularly familiar with).
I bet this issue is why the two other Hull teams that attempted this puzzle failed it.
If you fancy having a go at the sort of problems (or to prepare for next year!) then you may like to try https://open.kattis.com/